From 275d259fb814f869da64b3c1cd4e1802191162a0 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 188f2479cf7..89e120a2e01 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -611,7 +611,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