diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-04-15 15:14:59 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-04-15 15:14:59 +0700 |
| commit | e016af1d1ab8df064cbb852965173ab2d53093dd (patch) | |
| tree | ce78679bec52cc2bee7da9b9aefec6436e223f87 /indoteknik_custom/models/automatic_purchase.py | |
| parent | 28a268fde404c68706b903d4492f847310cc074e (diff) | |
fix bug automatic purchase and add already_paid on account move
Diffstat (limited to 'indoteknik_custom/models/automatic_purchase.py')
| -rw-r--r-- | indoteknik_custom/models/automatic_purchase.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index 911e35a8..c27950fd 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -154,15 +154,15 @@ class AutomaticPurchase(models.Model): def check_qty_po(self): for lines in self.purchase_lines: purchasing_job = self.env['v.purchasing.job'].search([ - ('product_id', '=', lines.product_id.id) - ], limit=1) + ('product_id', 'in', [lines.product_id.id]) + ]) po = self.env['purchase.order'].search([ - ('product_id', '=', lines.product_id.id), - ('order_sales_match_line.sale_id', '=', lines.automatic_purchase_id.sales_match.sale_id.id), + ('product_id', 'in', [lines.product_id.id]), + # ('order_sales_match_line.sale_id', 'in', [lines.automatic_purchase_id.sales_match.sale_id.id]), ('state', 'not in', ['cancel']), ('from_apo', '=', True) - ], limit=1) + ]) if not purchasing_job: raise UserError('Beberapa product sudah terbuat po dan sudah terconfirm') @@ -179,7 +179,8 @@ class AutomaticPurchase(models.Model): def create_po_by_vendor(self, vendor_id): current_time = datetime.now() - self.check_qty_po() + if not self.apo_type =='reordering': + self.check_qty_po() PRODUCT_PER_PO = 20 |
