feat(UAE VAT 21): Add vat settings

This commit is contained in:
hasnain2808
2020-09-28 14:38:14 +05:30
parent 2a601e59bf
commit 2d30148940
9 changed files with 133 additions and 4 deletions

View File

@@ -53,12 +53,13 @@ def get_tax_accounts(company):
tax_accounts: List of Tax Accounts for the company
"""
tax_accounts_dict = frappe._dict()
tax_accounts_list = frappe.get_all("Account",
filters={"account_type": "Tax", "company": company},
fields=["name"])
tax_accounts_list = frappe.get_all("UAE VAT Account",
filters={"parent": company},
fields=["Account"]
)
if not tax_accounts_list and not frappe.flags.in_test:
frappe.throw(_("Please create at least one Account of type Tax"))
frappe.throw(_(f'Please set Vat Accounts for Company: "{company}" in UAE VAT Setting'))
for d in tax_accounts_list:
for key, name in d.items():
tax_accounts_dict[name] = name