From a4c54afbda65e75308da1dae21eea160dcca479e Mon Sep 17 00:00:00 2001 From: Admin Date: Wed, 22 Jan 2025 18:27:08 +0530 Subject: [PATCH 1/3] fix: While applying the filter of Group by with customer group and territory showing error in reports --- .../item_wise_sales_register.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py index 1a6bcb3bd633..5f5ecf01b33f 100644 --- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py @@ -139,12 +139,13 @@ def _execute(filters=None, additional_table_columns=None, additional_conditions= if filters.get("group_by") and item_list: total_row = total_row_map.get(prev_group_by_value or d.get("item_name")) - total_row["percent_gt"] = flt(total_row["total"] / grand_total * 100) - data.append(total_row) - data.append({}) - add_sub_total_row(total_row, total_row_map, "total_row", tax_columns) - data.append(total_row_map.get("total_row")) - skip_total_row = 1 + if total_row: + total_row["percent_gt"] = flt(total_row["total"] / grand_total * 100) + data.append(total_row) + data.append({}) + add_sub_total_row(total_row, total_row_map, "total_row", tax_columns) + data.append(total_row_map.get("total_row")) + skip_total_row = 1 return columns, data, None, None, None, skip_total_row @@ -735,7 +736,7 @@ def add_total_row( add_sub_total_row(total_row, total_row_map, "total_row", tax_columns) prev_group_by_value = item.get(group_by_field, "") - + print(444444, prev_group_by_value) total_row_map.setdefault( item.get(group_by_field, ""), { From 404bfec1ce8d9fe639166cbdb7759735ce8265fb Mon Sep 17 00:00:00 2001 From: Admin Date: Wed, 22 Jan 2025 18:29:29 +0530 Subject: [PATCH 2/3] refactor: remove print --- .../report/item_wise_sales_register/item_wise_sales_register.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py index 5f5ecf01b33f..f0b58d9f8e60 100644 --- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py @@ -736,7 +736,6 @@ def add_total_row( add_sub_total_row(total_row, total_row_map, "total_row", tax_columns) prev_group_by_value = item.get(group_by_field, "") - print(444444, prev_group_by_value) total_row_map.setdefault( item.get(group_by_field, ""), { From d07ad703c2683def1dedabd49c46ac67d94f8fa0 Mon Sep 17 00:00:00 2001 From: Admin Date: Wed, 22 Jan 2025 18:33:48 +0530 Subject: [PATCH 3/3] fix: trial balace report not working --- .../report/trial_balance_simple/trial_balance_simple.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/report/trial_balance_simple/trial_balance_simple.json b/erpnext/accounts/report/trial_balance_simple/trial_balance_simple.json index 8081a472dc22..e767ca61c5d3 100644 --- a/erpnext/accounts/report/trial_balance_simple/trial_balance_simple.json +++ b/erpnext/accounts/report/trial_balance_simple/trial_balance_simple.json @@ -12,7 +12,7 @@ "name": "Trial Balance (Simple)", "owner": "Administrator", "prepared_report": 0, - "query": "select fiscal_year as \"Fiscal Year:Data:80\",\n\tcompany as \"Company:Data:220\",\n\tposting_date as \"Posting Date:Date:100\",\n\taccount as \"Account:Data:380\",\n\tsum(debit) as \"Debit:Currency:140\",\n\tsum(credit) as \"Credit:Currency:140\",\n\tfinance_book as \"Finance Book:Link/Finance Book:140\"\nfrom `tabGL Entry`\ngroup by fiscal_year, company, posting_date, account,\norder by fiscal_year, company, posting_date, account", + "query": "select fiscal_year as \"Fiscal Year:Data:80\",\n\tcompany as \"Company:Data:220\",\n\tposting_date as \"Posting Date:Date:100\",\n\taccount as \"Account:Data:380\",\n\tsum(debit) as \"Debit:Currency:140\",\n\tsum(credit) as \"Credit:Currency:140\",\n\t(ARRAY_AGG(finance_book))[1] as \"Finance Book:Link/Finance Book:140\"\nfrom `tabGL Entry`\ngroup by fiscal_year, company, posting_date, account\norder by fiscal_year, company, posting_date, account", "ref_doctype": "GL Entry", "report_name": "Trial Balance (Simple)", "report_type": "Query Report",