From 3a26823c62bda2984c5238a52b0f9902c483b983 Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Tue, 6 Feb 2024 14:01:06 +0530 Subject: [PATCH] refactor: fetch rate once tax category is set --- .../tax_withholding_details/tax_withholding_details.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 60713a10c1..a5a5cb3afe 100644 --- a/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py +++ b/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py @@ -63,16 +63,14 @@ def get_result( tax_amount += entry.credit - entry.debit # infer tax withholding category from the account if it's the single account for this category tax_withholding_category = tds_accounts.get(entry.account) - rate = tax_rate_map.get(tax_withholding_category) # or else the consolidated value from the voucher document if not tax_withholding_category: - # or else from the party default tax_withholding_category = tax_category_map.get(name) - rate = tax_rate_map.get(tax_withholding_category) + # or else from the party default if not tax_withholding_category: tax_withholding_category = party_map.get(party, {}).get("tax_withholding_category") - rate = tax_rate_map.get(tax_withholding_category) + rate = tax_rate_map.get(tax_withholding_category) if net_total_map.get(name): if voucher_type == "Journal Entry" and tax_amount and rate: # back calcalute total amount from rate and tax_amount