diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-09-24 10:19:24 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-09-24 10:19:24 +0700 |
| commit | f38c1291c45beebd9c44939aee1adbf46cdbd7dd (patch) | |
| tree | 16a9747f4e0703bd1b5788ef7b950e12711f6f95 | |
| parent | 62dfd611cac52a2099deabf26149b1779926ee7a (diff) | |
skip calculate margin if not have sale order
| -rwxr-xr-x | indoteknik_custom/models/purchase_order_line.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index 24afcab6..55381c6d 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -37,7 +37,7 @@ class PurchaseOrderLine(models.Model): def compute_item_margin(self): for line in self: - if not line.product_id or line.price_unit <= 0 or line.product_uom_qty <= 0 or line.product_id.type == 'service': + if not line.product_id or line.price_unit <= 0 or line.product_uom_qty <= 0 or line.product_id.type == 'service' or not line.order_id.sale_order_id.id: line.item_margin = 0 line.item_percent_margin = 0 continue |
