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

@ -0,0 +1,35 @@
{
"actions": [],
"autoname": "account",
"creation": "2020-09-28 11:30:45.472053",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"account"
],
"fields": [
{
"allow_in_quick_entry": 1,
"fieldname": "account",
"fieldtype": "Link",
"in_list_view": 1,
"in_preview": 1,
"label": "Account",
"options": "Account"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2020-09-28 12:02:56.444007",
"modified_by": "Administrator",
"module": "Regional",
"name": "UAE VAT Account",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class UAEVATAccount(Document):
pass

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestUAEVATSetting(unittest.TestCase):
pass

View File

@ -0,0 +1,8 @@
// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('UAE VAT Setting', {
// refresh: function(frm) {
// }
});

View File

@ -0,0 +1,55 @@
{
"actions": [],
"autoname": "field:company",
"creation": "2020-09-25 12:48:51.463265",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"company",
"uae_vat_account"
],
"fields": [
{
"fieldname": "company",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Company",
"options": "Company",
"reqd": 1,
"unique": 1
},
{
"fieldname": "uae_vat_account",
"fieldtype": "Table",
"label": "UAE VAT Account",
"options": "UAE VAT Account",
"reqd": 1
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2020-09-28 12:19:11.493138",
"modified_by": "Administrator",
"module": "Regional",
"name": "UAE VAT Setting",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class UAEVATSetting(Document):
pass

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