summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindoteknik_custom/models/sale_order.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 3c69c3d1..096ffe3a 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -1724,12 +1724,11 @@ class SaleOrder(models.Model):
else:
delivery_amt = 0
- # Net margin = total margin - biaya tambahan
- net_margin = order.total_margin - order.biaya_lain_lain
- denominator = order.amount_untaxed - order.fee_third_party
+ net_margin = order.total_margin - order.fee_third_party - order.biaya_lain_lain
- if denominator > 0:
- order.total_percent_margin = round((net_margin / denominator) * 100, 2)
+
+ if order.amount_untaxed > 0:
+ order.total_percent_margin = round((net_margin / order.amount_untaxed) * 100, 2)
else:
order.total_percent_margin = 0