Skip to content

Commit

Permalink
Merge pull request #1794 from resilient-tech/mergify/bp/version-14-ho…
Browse files Browse the repository at this point in the history
…tfix/pr-1793

fix: ignore mandatory if tds account is not found (backport #1793)
  • Loading branch information
vorasmit authored Feb 28, 2024
2 parents 7fa8754 + df6152d commit 07145ae
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions india_compliance/income_tax_india/overrides/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ def create_tds_account(company):

def create_or_update_tax_withholding_category(company):
accounts = []
abbr = frappe.get_value("Company", company, "abbr")
tds_account = frappe.get_value("Account", "TDS Payable - {0}".format(abbr), "name")
tds_account = frappe.get_value(
"Account", {"account_name": "TDS Payable", "company": company}, "name"
)

ignore_mandatory = False
if not tds_account:
ignore_mandatory = True

Check warning on line 36 in india_compliance/income_tax_india/overrides/company.py

View check run for this annotation

Codecov / codecov/patch

india_compliance/income_tax_india/overrides/company.py#L36

Added line #L36 was not covered by tests

if company and tds_account:
accounts.append({"company": company, "account": tds_account})
Expand All @@ -46,7 +51,7 @@ def create_or_update_tax_withholding_category(company):

if not existing_category_name:
doc = frappe.get_doc(category_doc)
doc.insert(ignore_if_duplicate=True)
doc.insert(ignore_if_duplicate=True, ignore_mandatory=ignore_mandatory)

else:
update_existing_tax_withholding_category(
Expand Down

0 comments on commit 07145ae

Please sign in to comment.