From 12b459df8c860f0d8df654ba2339dba9265480f9 Mon Sep 17 00:00:00 2001 From: Dany Robert Date: Mon, 10 Jul 2023 10:35:45 +0000 Subject: [PATCH] fix: skip twc if not account set --- .../tax_withholding_category.py | 11 +++++++---- 1 file changed, 7 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 58792d1d8a..3ff0a40a3e 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py @@ -100,11 +100,14 @@ def get_party_tax_withholding_details(inv, tax_withholding_category=None): tax_details = get_tax_withholding_details(tax_withholding_category, posting_date, inv.company) if not tax_details: - frappe.throw( - _("Please set associated account in Tax Withholding Category {0} against Company {1}").format( - tax_withholding_category, inv.company - ) + frappe.msgprint( + _( + "Skipping Tax Withholding Category {0} as there is no associated account set for Company {1} in it." + ).format(tax_withholding_category, inv.company) ) + if inv.doctype == "Purchase Invoice": + return {}, [], {} + return {} if party_type == "Customer" and not tax_details.cumulative_threshold: # TCS is only chargeable on sum of invoiced value