diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-04-24 14:27:15 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-04-24 14:27:15 +0700 |
| commit | 0c577a495101b4f8b6034d3fe097a0a53502d9b2 (patch) | |
| tree | d565a2482c485190f10dc0a3940c8e58d31e8a78 | |
| parent | 9441cb7145af70b1e5a4175c9e15b076bab3fdf0 (diff) | |
fix bug
| -rwxr-xr-x | indoteknik_custom/models/purchase_order_line.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index 93b235d8..624415e3 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -40,15 +40,14 @@ class PurchaseOrderLine(models.Model): delete_line = fields.Boolean(string='Delete', default=False, help='centang ini jika anda ingin menghapus line ini') is_edit_product_qty = fields.Boolean(string='Is Edit Product Qty', compute='_compute_is_edit_product_qty') - @api.constrains('purchase_price') + @api.constrains('price_unit') def constrains_purchase_price(self): - for line in self: - matches_so = self.env['purchase.order.sales.match'].search([ - ('purchase_order_id', '=', line.order_id.id), - ('product_id', '=', line.product_id.id), - ]) + matches_so = self.env['purchase.order.sales.match'].search([ + ('purchase_order_id', '=', self.order_id.id), + ('product_id', '=', self.product_id.id), + ]) - line.purchase_price = matches_so.sale_line_id.purchase_price + matches_so.sale_line_id.purchase_price = self.price_unit @api.constrains('product_qty') def constrains_product_qty(self): |
