From 88370162437652fd16ffde3d77eaca2025e06c3c Mon Sep 17 00:00:00 2001 From: ravibharathi656 Date: Fri, 1 Aug 2025 17:01:11 +0530 Subject: [PATCH] fix(tax withholding details): avoid voucher duplication --- .../tax_withholding_details/tax_withholding_details.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py b/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py index d8012377743..2f557d01710 100644 --- a/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py +++ b/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py @@ -45,6 +45,7 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_ gle_map = get_gle_map(tds_docs) out = [] + entries = {} for name, details in gle_map.items(): for entry in details: tax_amount, total_amount, grand_total, base_total = 0, 0, 0, 0 @@ -119,8 +120,13 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_ "supplier_invoice_date": bill_date, } ) - out.append(row) + key = entry.voucher_no + if key in entries: + entries[key]["tax_amount"] += tax_amount + else: + entries[key] = row + out = list(entries.values()) out.sort(key=lambda x: (x["section_code"], x["transaction_date"])) return out