diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-11-03 13:46:16 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-11-03 13:46:16 +0700 |
| commit | e94cfd1fee485d0e84fb50a66a7584572452b5dc (patch) | |
| tree | 7f0e82becba364b8b984ef27df660635d1e1f9f6 /indoteknik_custom/models/automatic_purchase.py | |
| parent | 566a20db595a2b0a1959a12d289361b16e1ef172 (diff) | |
| parent | 6b49797aca36574497f93a06f8e1c0622e5ad009 (diff) | |
Merge branch 'production' of bitbucket.org:altafixco/indoteknik-addons into production
# Conflicts:
# indoteknik_custom/__manifest__.py
# indoteknik_custom/models/__init__.py
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 |
