From ab188c4404da9a443f39dc4e20d2fa3b62de062d Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Tue, 21 Apr 2026 18:33:25 +0530 Subject: [PATCH 1/6] refactor: use consistent report column names (cherry picked from commit 7630c01e40d0de69822919f4196147ad0cfc0fb3) # Conflicts: # erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py --- .../tds_computation_summary.py | 14 +++++++------- .../tds_payable_monthly/tds_payable_monthly.py | 12 ++++++++---- .../test_tds_payable_monthly.py | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py index d876d6d14d2..c0c59bdb305 100644 --- a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py +++ b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py @@ -53,25 +53,25 @@ def group_by_party_and_category(data, filters): for row in data: party_category_wise_map.setdefault( - (row.get("party"), row.get("section_code")), + (row.get("party"), row.get("tax_withholding_category")), { "pan": row.get("pan"), "tax_id": row.get("tax_id"), "party": row.get("party"), "party_name": row.get("party_name"), - "section_code": row.get("section_code"), - "entity_type": row.get("entity_type"), + "tax_withholding_category": row.get("tax_withholding_category"), + "party_entity_type": row.get("party_entity_type"), "rate": row.get("rate"), "total_amount": 0.0, "tax_amount": 0.0, }, ) - party_category_wise_map.get((row.get("party"), row.get("section_code")))["total_amount"] += row.get( + party_category_wise_map.get((row.get("party"), row.get("tax_withholding_category")))["total_amount"] += row.get( "total_amount", 0.0 ) - party_category_wise_map.get((row.get("party"), row.get("section_code")))["tax_amount"] += row.get( + party_category_wise_map.get((row.get("party"), row.get("tax_withholding_category")))["tax_amount"] += row.get( "tax_amount", 0.0 ) @@ -116,11 +116,11 @@ def get_columns(filters): { "label": _("Section Code"), "options": "Tax Withholding Category", - "fieldname": "section_code", + "fieldname": "tax_withholding_category", "fieldtype": "Link", "width": 180, }, - {"label": _("Entity Type"), "fieldname": "entity_type", "fieldtype": "Data", "width": 180}, + {"label": _("Entity Type"), "fieldname": "party_entity_type", "fieldtype": "Data", "width": 180}, { "label": _("TDS Rate %") if filters.get("party_type") == "Supplier" else _("TCS Rate %"), "fieldname": "rate", diff --git a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py index 39f7be87e9e..8dda1486fce 100644 --- a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py +++ b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py @@ -106,8 +106,8 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_ row.update( { - "section_code": tax_withholding_category or "", - "entity_type": party_map.get(party, {}).get(party_type), + "tax_withholding_category": tax_withholding_category or "", + "party_entity_type": party_map.get(party, {}).get(party_type), "rate": rate, "total_amount": total_amount, "grand_total": grand_total, @@ -127,7 +127,11 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_ else: entries[key] = row out = list(entries.values()) +<<<<<<< HEAD:erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py out.sort(key=lambda x: (x["section_code"], x["transaction_date"])) +======= + out.sort(key=lambda x: (x["tax_withholding_category"], x["transaction_date"], x["ref_no"])) +>>>>>>> 7630c01e40 (refactor: use consistent report column names):erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py return out @@ -179,7 +183,7 @@ def get_columns(filters): { "label": _("Section Code"), "options": "Tax Withholding Category", - "fieldname": "section_code", + "fieldname": "tax_withholding_category", "fieldtype": "Link", "width": 90, }, @@ -208,7 +212,7 @@ def get_columns(filters): columns.extend( [ - {"label": _("Entity Type"), "fieldname": "entity_type", "fieldtype": "Data", "width": 100}, + {"label": _("Entity Type"), "fieldname": "party_entity_type", "fieldtype": "Data", "width": 100}, ] ) if filters.party_type == "Supplier": diff --git a/erpnext/accounts/report/tds_payable_monthly/test_tds_payable_monthly.py b/erpnext/accounts/report/tds_payable_monthly/test_tds_payable_monthly.py index 63492b6c19c..4083d32ae76 100644 --- a/erpnext/accounts/report/tds_payable_monthly/test_tds_payable_monthly.py +++ b/erpnext/accounts/report/tds_payable_monthly/test_tds_payable_monthly.py @@ -118,7 +118,7 @@ class TestTdsPayableMonthly(AccountsTestMixin, FrappeTestCase): voucher_expected_values = expected_values[i] voucher_actual_values = ( voucher.ref_no, - voucher.section_code, + voucher.tax_withholding_category, voucher.rate, voucher.base_total, voucher.tax_amount, From e1ff203f95fb0059dc18a3222cd70d2eccd03a21 Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Wed, 22 Apr 2026 12:11:04 +0530 Subject: [PATCH 2/6] refactor: better label for entity type (cherry picked from commit 8e12bda108bc2a354b0e90b4d01be0e166889873) --- .../tds_computation_summary.py | 21 ++++++++++++------- .../tds_payable_monthly.py | 9 ++++++-- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py index c0c59bdb305..b10ae805ac2 100644 --- a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py +++ b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py @@ -67,13 +67,13 @@ def group_by_party_and_category(data, filters): }, ) - party_category_wise_map.get((row.get("party"), row.get("tax_withholding_category")))["total_amount"] += row.get( - "total_amount", 0.0 - ) + party_category_wise_map.get((row.get("party"), row.get("tax_withholding_category")))[ + "total_amount" + ] += row.get("total_amount", 0.0) - party_category_wise_map.get((row.get("party"), row.get("tax_withholding_category")))["tax_amount"] += row.get( - "tax_amount", 0.0 - ) + party_category_wise_map.get((row.get("party"), row.get("tax_withholding_category")))[ + "tax_amount" + ] += row.get("tax_amount", 0.0) final_result = get_final_result(party_category_wise_map) @@ -114,13 +114,18 @@ def get_columns(filters): columns.extend( [ { - "label": _("Section Code"), + "label": _("Tax Withholding Category"), "options": "Tax Withholding Category", "fieldname": "tax_withholding_category", "fieldtype": "Link", "width": 180, }, - {"label": _("Entity Type"), "fieldname": "party_entity_type", "fieldtype": "Data", "width": 180}, + { + "label": _(f"{filters.get('party_type', 'Party')} Type"), + "fieldname": "party_entity_type", + "fieldtype": "Data", + "width": 180, + }, { "label": _("TDS Rate %") if filters.get("party_type") == "Supplier" else _("TCS Rate %"), "fieldname": "rate", diff --git a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py index 8dda1486fce..650928e879b 100644 --- a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py +++ b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py @@ -181,7 +181,7 @@ def get_columns(filters): pan = "pan" if frappe.db.has_column(filters.party_type, "pan") else "tax_id" columns = [ { - "label": _("Section Code"), + "label": _("Tax Withholding Category"), "options": "Tax Withholding Category", "fieldname": "tax_withholding_category", "fieldtype": "Link", @@ -212,7 +212,12 @@ def get_columns(filters): columns.extend( [ - {"label": _("Entity Type"), "fieldname": "party_entity_type", "fieldtype": "Data", "width": 100}, + { + "label": _(f"{filters.get('party_type', 'Party')} Type"), + "fieldname": "party_entity_type", + "fieldtype": "Data", + "width": 100, + }, ] ) if filters.party_type == "Supplier": From 6eb2868a15ed79dd4ce001cbecb421587fe7ad25 Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Wed, 22 Apr 2026 12:12:18 +0530 Subject: [PATCH 3/6] fix: add party_type for dynamic link and add it to grouping key (cherry picked from commit a3ad1fb163d537c0dd66c78c6522d7607604eee2) --- .../report/tds_computation_summary/tds_computation_summary.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py index b10ae805ac2..3aed6b14a7f 100644 --- a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py +++ b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py @@ -53,11 +53,12 @@ def group_by_party_and_category(data, filters): for row in data: party_category_wise_map.setdefault( - (row.get("party"), row.get("tax_withholding_category")), + (row.get("party_type"), row.get("party"), row.get("tax_withholding_category")), { "pan": row.get("pan"), "tax_id": row.get("tax_id"), "party": row.get("party"), + "party_type": row.get("party_type"), "party_name": row.get("party_name"), "tax_withholding_category": row.get("tax_withholding_category"), "party_entity_type": row.get("party_entity_type"), From 32d46b3e88316a1e49414df3124ee087d79822b9 Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Thu, 23 Apr 2026 15:01:46 +0530 Subject: [PATCH 4/6] fix: use key consistently (cherry picked from commit 8f9a5e6c0cf28bdbbad6c9f5fd99bc421033fda0) --- .../tds_computation_summary.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py index 3aed6b14a7f..c5e9ec44c6f 100644 --- a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py +++ b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py @@ -52,8 +52,9 @@ def group_by_party_and_category(data, filters): party_category_wise_map = {} for row in data: + key = (row.get("party_type"), row.get("party"), row.get("tax_withholding_category")) party_category_wise_map.setdefault( - (row.get("party_type"), row.get("party"), row.get("tax_withholding_category")), + key, { "pan": row.get("pan"), "tax_id": row.get("tax_id"), @@ -68,13 +69,8 @@ def group_by_party_and_category(data, filters): }, ) - party_category_wise_map.get((row.get("party"), row.get("tax_withholding_category")))[ - "total_amount" - ] += row.get("total_amount", 0.0) - - party_category_wise_map.get((row.get("party"), row.get("tax_withholding_category")))[ - "tax_amount" - ] += row.get("tax_amount", 0.0) + party_category_wise_map.get(key)["total_amount"] += row.get("total_amount", 0.0) + party_category_wise_map.get(key)["tax_amount"] += row.get("tax_amount", 0.0) final_result = get_final_result(party_category_wise_map) From 34e94d6e7abd4939bca0f2b1f340d60c11f39ba9 Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Thu, 23 Apr 2026 15:36:47 +0530 Subject: [PATCH 5/6] chore: resolve conflicts --- .../report/tds_payable_monthly/tds_payable_monthly.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py index 650928e879b..710a557e909 100644 --- a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py +++ b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py @@ -127,11 +127,7 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_ else: entries[key] = row out = list(entries.values()) -<<<<<<< HEAD:erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py - out.sort(key=lambda x: (x["section_code"], x["transaction_date"])) -======= out.sort(key=lambda x: (x["tax_withholding_category"], x["transaction_date"], x["ref_no"])) ->>>>>>> 7630c01e40 (refactor: use consistent report column names):erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py return out From 83fd6550421d6205cc1d9feadff67140e7cc32bd Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Thu, 23 Apr 2026 17:42:31 +0530 Subject: [PATCH 6/6] chore: translate values correctly --- .../report/tds_computation_summary/tds_computation_summary.py | 2 +- .../accounts/report/tds_payable_monthly/tds_payable_monthly.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py index c5e9ec44c6f..de961ba6c4c 100644 --- a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py +++ b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py @@ -118,7 +118,7 @@ def get_columns(filters): "width": 180, }, { - "label": _(f"{filters.get('party_type', 'Party')} Type"), + "label": _("{0} Type").format(_(filters.get("party_type", "Party"))), "fieldname": "party_entity_type", "fieldtype": "Data", "width": 180, diff --git a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py index 710a557e909..03289641447 100644 --- a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py +++ b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py @@ -209,7 +209,7 @@ def get_columns(filters): columns.extend( [ { - "label": _(f"{filters.get('party_type', 'Party')} Type"), + "label": _("{0} Type").format(_(filters.get("party_type", "Party"))), "fieldname": "party_entity_type", "fieldtype": "Data", "width": 100,