refactor: use consistent report column names

(cherry picked from commit 7630c01e40)

# Conflicts:
#	erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py
This commit is contained in:
Smit Vora
2026-04-21 18:33:25 +05:30
committed by Mergify
parent c5ed69c2c2
commit ab188c4404
3 changed files with 16 additions and 12 deletions

View File

@@ -53,25 +53,25 @@ def group_by_party_and_category(data, filters):
for row in data: for row in data:
party_category_wise_map.setdefault( party_category_wise_map.setdefault(
(row.get("party"), row.get("section_code")), (row.get("party"), row.get("tax_withholding_category")),
{ {
"pan": row.get("pan"), "pan": row.get("pan"),
"tax_id": row.get("tax_id"), "tax_id": row.get("tax_id"),
"party": row.get("party"), "party": row.get("party"),
"party_name": row.get("party_name"), "party_name": row.get("party_name"),
"section_code": row.get("section_code"), "tax_withholding_category": row.get("tax_withholding_category"),
"entity_type": row.get("entity_type"), "party_entity_type": row.get("party_entity_type"),
"rate": row.get("rate"), "rate": row.get("rate"),
"total_amount": 0.0, "total_amount": 0.0,
"tax_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 "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 "tax_amount", 0.0
) )
@@ -116,11 +116,11 @@ def get_columns(filters):
{ {
"label": _("Section Code"), "label": _("Section Code"),
"options": "Tax Withholding Category", "options": "Tax Withholding Category",
"fieldname": "section_code", "fieldname": "tax_withholding_category",
"fieldtype": "Link", "fieldtype": "Link",
"width": 180, "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 %"), "label": _("TDS Rate %") if filters.get("party_type") == "Supplier" else _("TCS Rate %"),
"fieldname": "rate", "fieldname": "rate",

View File

@@ -106,8 +106,8 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_
row.update( row.update(
{ {
"section_code": tax_withholding_category or "", "tax_withholding_category": tax_withholding_category or "",
"entity_type": party_map.get(party, {}).get(party_type), "party_entity_type": party_map.get(party, {}).get(party_type),
"rate": rate, "rate": rate,
"total_amount": total_amount, "total_amount": total_amount,
"grand_total": grand_total, "grand_total": grand_total,
@@ -127,7 +127,11 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_
else: else:
entries[key] = row entries[key] = row
out = list(entries.values()) 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["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 return out
@@ -179,7 +183,7 @@ def get_columns(filters):
{ {
"label": _("Section Code"), "label": _("Section Code"),
"options": "Tax Withholding Category", "options": "Tax Withholding Category",
"fieldname": "section_code", "fieldname": "tax_withholding_category",
"fieldtype": "Link", "fieldtype": "Link",
"width": 90, "width": 90,
}, },
@@ -208,7 +212,7 @@ def get_columns(filters):
columns.extend( 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": if filters.party_type == "Supplier":

View File

@@ -118,7 +118,7 @@ class TestTdsPayableMonthly(AccountsTestMixin, FrappeTestCase):
voucher_expected_values = expected_values[i] voucher_expected_values = expected_values[i]
voucher_actual_values = ( voucher_actual_values = (
voucher.ref_no, voucher.ref_no,
voucher.section_code, voucher.tax_withholding_category,
voucher.rate, voucher.rate,
voucher.base_total, voucher.base_total,
voucher.tax_amount, voucher.tax_amount,