From fa4af393aff5c995fd963a3faa9b14d0bb8c7eb2 Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Thu, 8 Feb 2024 17:22:25 +0100 Subject: [PATCH] fix: Incorrect margin calculation --- erpnext/controllers/selling_controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index 54aefa89eff..0db49bfbf2f 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -614,7 +614,7 @@ class SellingController(StockController): total_selling_amount = 0.0 for item in self.items: total_gross_profit += item.gross_profit or 0.0 - total_cost += (item.unit_cost_price or 0.0) * (item.stock_qty * 0.0) + total_cost += (item.unit_cost_price or 0.0) * (item.stock_qty or 0.0) total_selling_amount += item.base_amount or 0.0 if item.unit_cost_price: item.gross_profit_percentage = flt( -- GitLab