From 7ce81127d2321519d009bbee3f68bf181cd4cc57 Mon Sep 17 00:00:00 2001 From: ravibharathi656 Date: Mon, 27 Oct 2025 17:44:12 +0530 Subject: [PATCH] fix: avoid group columns mutation --- erpnext/accounts/report/gross_profit/gross_profit.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index 256e4f959e8..baf2da6ceea 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -233,9 +233,12 @@ def get_data_when_not_grouped_by_invoice(gross_profit_data, filters, group_wise_ # removing customer_name from group columns customer_master_name = frappe.db.get_single_value("Selling Settings", "cust_master_name") + supplier_master_name = frappe.db.get_single_value("Buying Settings", "supp_master_name") - if "customer_name" in group_columns and customer_master_name == "Customer Name": - group_columns.remove("customer_name") + if "customer_name" in group_columns and ( + supplier_master_name == "Supplier Name" and customer_master_name == "Customer Name" + ): + group_columns = [col for col in group_columns if col != "customer_name"] for src in gross_profit_data.grouped_data: total_base_amount += src.base_amount or 0.00