From ac37a854362dbaaf8a88431ea5ab077a37f3c5f9 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 28 Sep 2022 17:17:44 +0700 Subject: Update purchase_order.py and purchase_order_line.py --- indoteknik_custom/models/purchase_order_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/purchase_order_line.py') diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index fcfab1da..4965b507 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -42,7 +42,7 @@ class PurchaseOrderLine(models.Model): def compute_item_margin(self): sum_so_margin = sum_sales_price = sum_margin = 0 for line in self: - if not line.product_id or line.product_id.type == 'service': + if not line.product_id or line.product_id.type == 'service' or not self.order_id.sale_order_id: line.so_item_margin = 0 line.so_item_percent_margin = 0 line.item_margin = 0 -- cgit v1.2.3