diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-10-26 11:10:04 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-10-26 11:10:04 +0700 |
| commit | cdd2e38987e4db045809b5af65fc12c16cf20186 (patch) | |
| tree | 835e92eabb6c8daba9ccd000f6912e5a6c3c687a /indoteknik_custom/models/automatic_purchase.py | |
| parent | 556c95e1fe466448eee0e823adc6a5757638272d (diff) | |
| parent | 8cba1eaa340eb0c6b264672b0a47dc1628c2eb04 (diff) | |
Merge branch 'automatic-purchase-split' into production
Diffstat (limited to 'indoteknik_custom/models/automatic_purchase.py')
| -rw-r--r-- | indoteknik_custom/models/automatic_purchase.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index 990d3cc5..f81ecdcc 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -17,6 +17,7 @@ class AutomaticPurchase(models.Model): is_po = fields.Boolean(string='Is PO') purchase_match = fields.One2many('automatic.purchase.match', 'automatic_purchase_id', string='Matches', auto_join=True) vendor_id = fields.Many2one('res.partner', string='Vendor', help='boleh kosong, jika diisi, maka hanya keluar data untuk vendor tersebut') + responsible_id = fields.Many2one('res.users', string='Responsible', required=True) def create_po_from_automatic_purchase(self): if not self.purchase_lines: @@ -87,7 +88,8 @@ class AutomaticPurchase(models.Model): raise UserError('Sudah digenerate sebelumnya, hapus line terlebih dahulu') query = [ - ('product_min_qty', '>', 0) + ('product_min_qty', '>', 0), + ('product_id.x_manufacture.user_id.id', '=', self.responsible_id.id) ] orderpoints = self.env['stock.warehouse.orderpoint'].search(query) count = 0 @@ -101,10 +103,14 @@ class AutomaticPurchase(models.Model): if self.vendor_id: purchase_price = self.env['purchase.pricelist'].search([ ('product_id', '=', point.product_id.id), + # ('product_id.x_manufacture.user_id.id', '=', self.responsible_id.id), ('vendor_id', '=', self.vendor_id.id) ], order='product_price asc', limit=1) else: - purchase_price = self.env['purchase.pricelist'].search([('product_id', '=', point.product_id.id)], order='product_price asc', limit=1) + purchase_price = self.env['purchase.pricelist'].search([ + ('product_id', '=', point.product_id.id), + # ('product_id.x_manufacture.user_id.id', '=', self.responsible_id.id), + ], order='product_price asc', limit=1) vendor_id = purchase_price.vendor_id.id price = purchase_price.product_price or 0 |
