diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-04-15 09:13:36 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-04-15 09:13:36 +0700 |
| commit | 84c48d915c551a5454ce5a32f1554322f6d2847c (patch) | |
| tree | 2faaf308d5f2ff8682f844d61a1fd6044df71173 | |
| parent | 997abf8c689d509c21955ecf39ffce5a236523ff (diff) | |
fix bug automatic purchase
| -rw-r--r-- | indoteknik_custom/models/automatic_purchase.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index c8bd37f0..6e11fd78 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -154,22 +154,22 @@ 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) + ('product_id', 'in', [lines.product_id.id]) ], limit=1) po = self.env['purchase.order'].search([ - ('product_id', '=', lines.product_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') for line in po.order_line: - qty_pj = po.product_qty + lines.qty_purchase - qty_outgoing_pj = po.qty_outgoing + qty_pj = line.product_qty + lines.qty_purchase + qty_outgoing_pj = line.qty_outgoing if qty_pj > qty_outgoing_pj: raise UserError('Qty yang anda beli lebih dari qty outgoing') |
