From d55fe7d33f42a778c8f7064a073c7b0db7884a73 Mon Sep 17 00:00:00 2001 From: ljain112 Date: Thu, 19 Dec 2024 16:27:04 +0530 Subject: [PATCH] fix: correct tds rate with lower deduction certificate (cherry picked from commit cb9c12d4952f68cf4a175fdd3adc470f37e40272) --- .../tax_withholding_category/tax_withholding_category.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py index 57039424948..15287f200fb 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py @@ -215,14 +215,14 @@ def get_tax_row_for_tds(tax_details, tax_amount): } -def get_lower_deduction_certificate(company, tax_details, pan_no): +def get_lower_deduction_certificate(company, posting_date, tax_details, pan_no): ldc_name = frappe.db.get_value( "Lower Deduction Certificate", { "pan_no": pan_no, "tax_withholding_category": tax_details.tax_withholding_category, - "valid_from": (">=", tax_details.from_date), - "valid_upto": ("<=", tax_details.to_date), + "valid_from": ("<=", posting_date), + "valid_upto": (">=", posting_date), "company": company, }, "name", @@ -270,7 +270,7 @@ def get_tax_amount(party_type, parties, inv, tax_details, posting_date, pan_no=N tax_amount = 0 if party_type == "Supplier": - ldc = get_lower_deduction_certificate(inv.company, tax_details, pan_no) + ldc = get_lower_deduction_certificate(inv.company, posting_date, tax_details, pan_no) if tax_deducted: net_total = inv.tax_withholding_net_total if ldc: