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 ff8816dba4d..a1b9c22f63f 100644 --- a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py +++ b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py @@ -48,8 +48,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"), @@ -64,13 +65,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)