refactor: better label for entity type

This commit is contained in:
Smit Vora
2026-04-22 12:11:04 +05:30
parent 7630c01e40
commit 8e12bda108
2 changed files with 20 additions and 10 deletions

View File

@@ -205,7 +205,7 @@ def get_columns(filters):
pan = "pan" if frappe.db.has_column(filters.party_type, "pan") else "tax_id" pan = "pan" if frappe.db.has_column(filters.party_type, "pan") else "tax_id"
columns = [ columns = [
{ {
"label": _("Section Code"), "label": _("Tax Withholding Category"),
"options": "Tax Withholding Category", "options": "Tax Withholding Category",
"fieldname": "tax_withholding_category", "fieldname": "tax_withholding_category",
"fieldtype": "Link", "fieldtype": "Link",
@@ -236,7 +236,12 @@ def get_columns(filters):
columns.extend( 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": if filters.party_type == "Supplier":

View File

@@ -63,13 +63,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( party_category_wise_map.get((row.get("party"), row.get("tax_withholding_category")))[
"total_amount", 0.0 "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( party_category_wise_map.get((row.get("party"), row.get("tax_withholding_category")))[
"tax_amount", 0.0 "tax_amount"
) ] += row.get("tax_amount", 0.0)
final_result = get_final_result(party_category_wise_map) final_result = get_final_result(party_category_wise_map)
@@ -110,13 +110,18 @@ def get_columns(filters):
columns.extend( columns.extend(
[ [
{ {
"label": _("Section Code"), "label": _("Tax Withholding Category"),
"options": "Tax Withholding Category", "options": "Tax Withholding Category",
"fieldname": "tax_withholding_category", "fieldname": "tax_withholding_category",
"fieldtype": "Link", "fieldtype": "Link",
"width": 180, "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 %"), "label": _("TDS Rate %") if filters.get("party_type") == "Supplier" else _("TCS Rate %"),
"fieldname": "rate", "fieldname": "rate",