From 32456bff30537811b63bd5c2f37eb731c4bacafe Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 28 Sep 2022 20:11:00 +0530 Subject: [PATCH] fix: Incorrect TCS amount deducted in Sales Invoice (cherry picked from commit 08443c64210227f5bd1caf07461dd1cba2b392b2) --- .../tax_withholding_category/tax_withholding_category.py | 6 ++++++ 1 file changed, 6 insertions(+) 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 2d169f70aa04..8b9923ae0872 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py @@ -326,6 +326,9 @@ def get_advance_vouchers( "party": ["in", parties], } + if party_type == "Customer": + filters.update({"against_voucher": ["is", "not set"]}) + if company: filters["company"] = company if from_date and to_date: @@ -491,10 +494,13 @@ def get_tcs_amount(parties, inv, tax_details, vouchers, adv_vouchers): cumulative_threshold = tax_details.get("cumulative_threshold", 0) current_invoice_total = get_invoice_total_without_tcs(inv, tax_details) + print(invoiced_amt, advance_amt, credit_note_amt, current_invoice_total) total_invoiced_amt = current_invoice_total + invoiced_amt + advance_amt - credit_note_amt + print(total_invoiced_amt, "######", "total_invoiced_amt") if cumulative_threshold and total_invoiced_amt >= cumulative_threshold: chargeable_amt = total_invoiced_amt - cumulative_threshold + print(chargeable_amt, "#########") tcs_amount = chargeable_amt * tax_details.rate / 100 if chargeable_amt > 0 else 0 return tcs_amount