diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2026-01-01 00:50:26 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2026-01-01 00:50:26 +0700 |
| commit | 7f75982f2db861e381d418e3dd4311b503a34070 (patch) | |
| tree | add96cb994366737ababc94d29fee10eed53622f /fixco_custom/models/reordering_rule.py | |
| parent | aaaf75e4f4c62b7481c354456909e958d1631379 (diff) | |
push fix webhook ginee to detail order
Diffstat (limited to 'fixco_custom/models/reordering_rule.py')
| -rw-r--r-- | fixco_custom/models/reordering_rule.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fixco_custom/models/reordering_rule.py b/fixco_custom/models/reordering_rule.py index 787875b..107d40b 100644 --- a/fixco_custom/models/reordering_rule.py +++ b/fixco_custom/models/reordering_rule.py @@ -42,11 +42,14 @@ class ReorderingRule(models.Model): qty_purchase = max(qty_purchase, 0.0) - pricelist = self.env['purchase.pricelist'].search([ - ('product_id', '=', stock.product_id.id), - ('vendor_id', '=', stock.vendor_id.id) + pricelist = self.env['product.supplierinfo'].search([ + ('product_tmpl_id', '=', stock.product_id.product_tmpl_id.id), + ('name', '=', stock.vendor_id.id) ], limit=1) + if not pricelist: + raise UserError("No pricelist found for product %s and vendor %s" % (stock.product_id.name, stock.vendor_id.name)) + price = pricelist.price if pricelist else 0.0 subtotal = qty_purchase * price |
