From 756d496235af3223e64ae33c51fd5b63d91856da Mon Sep 17 00:00:00 2001 From: venkat102 Date: Thu, 17 Apr 2025 00:12:43 +0530 Subject: [PATCH] fix: add group by after user permission condition --- erpnext/accounts/report/financial_statements.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index 67154455f95..0d1e185382d 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -519,9 +519,6 @@ def get_accounting_entries( .where(gl_entry.company == filters.company) ) - if group_by_account: - query = query.groupby(gl_entry.account) - ignore_is_opening = frappe.db.get_single_value( "Accounts Settings", "ignore_is_opening_check_for_reporting" ) @@ -551,6 +548,9 @@ def get_accounting_entries( if match_conditions: query += "and" + match_conditions + if group_by_account: + query += " GROUP BY `account`" + return frappe.db.sql(query, params, as_dict=True)