diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-04-24 13:45:43 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-04-24 13:45:43 +0700 |
| commit | 68c7f85b0bf7b8eb85f5bbffcfe2bbc8a38b7e4e (patch) | |
| tree | e9982aa981deb8b9d7c42a51322f897ac38e6d0b /indoteknik_custom/models/purchase_order_line.py | |
| parent | 5840f4fce3776a6c14a8f46ed156284b301d8af1 (diff) | |
update purchasing job
Diffstat (limited to 'indoteknik_custom/models/purchase_order_line.py')
| -rwxr-xr-x | indoteknik_custom/models/purchase_order_line.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index b9c4011e..93b235d8 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -40,6 +40,16 @@ 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') + 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), + ]) + + line.purchase_price = matches_so.sale_line_id.purchase_price + @api.constrains('product_qty') def constrains_product_qty(self): for line in self: |
