diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2024-05-21 09:21:33 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2024-05-21 09:21:33 +0700 |
| commit | 8da2a7fe0de6f0abe4e35831e5e5560c20b5b627 (patch) | |
| tree | ed6629bcf59841e8343f5a9c9590d0ff4878b1fc /indoteknik_custom/models/sale_order.py | |
| parent | 92413dbeda6eebc85731536dd698bb155b09d7df (diff) | |
bug fix total margin so, forgot deduction of delivery amount
Diffstat (limited to 'indoteknik_custom/models/sale_order.py')
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index aa34b0f4..fbb5e7a2 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -582,7 +582,12 @@ class SaleOrder(models.Model): if order.amount_untaxed == 0: order.total_percent_margin = 0 continue - order.total_percent_margin = round((order.total_margin / order.amount_untaxed) * 100, 2) + if order.shipping_cost_covered == 'indoteknik': + delivery_amt = order.delivery_amt + else: + delivery_amt = 0 + order.total_percent_margin = round((order.total_margin / (order.amount_untaxed-delivery_amt)) * 100, 2) + # order.total_percent_margin = round((order.total_margin / (order.amount_untaxed)) * 100, 2) @api.onchange('sales_tax_id') def onchange_sales_tax_id(self): |
