From fca284ba540d92c8e379d7779173278408a8d31f Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 10 Jul 2023 15:20:13 +0700 Subject: refactor Re-Calculate SO di PO --- indoteknik_custom/models/purchase_order.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index efc98e2f..db76a919 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -220,12 +220,9 @@ class PurchaseOrder(models.Model): sale_order_line = self.env['sale.order.line'].search( [('product_id', '=', line.product_id.id), ('order_id', '=', line.order_id.sale_order_id.id)], limit=1, order='price_reduce_taxexcl') - - unit_price = line.price_unit - sale_order_line.purchase_price = unit_price - - total_percent_margin = self.total_percent_margin - self.sale_order_id.total_percent_margin = total_percent_margin + for so_line in sale_order_line: + unit_price = line.price_unit + so_line.purchase_price = unit_price def button_cancel(self): res = super(PurchaseOrder, self).button_cancel() -- cgit v1.2.3