From 2d3014894013a9fa0650a215aae4c3dcbdb683a6 Mon Sep 17 00:00:00 2001 From: hasnain2808 Date: Mon, 28 Sep 2020 14:38:14 +0530 Subject: [PATCH] feat(UAE VAT 21): Add vat settings --- .../doctype/uae_vat_account/__init__.py | 0 .../uae_vat_account/uae_vat_account.json | 35 ++++++++++++ .../uae_vat_account/uae_vat_account.py | 10 ++++ .../doctype/uae_vat_setting/__init__.py | 0 .../uae_vat_setting/test_uae_vat_setting.py | 10 ++++ .../uae_vat_setting/uae_vat_setting.js | 8 +++ .../uae_vat_setting/uae_vat_setting.json | 55 +++++++++++++++++++ .../uae_vat_setting/uae_vat_setting.py | 10 ++++ .../regional/united_arab_emirates/utils.py | 9 +-- 9 files changed, 133 insertions(+), 4 deletions(-) create mode 100644 erpnext/regional/doctype/uae_vat_account/__init__.py create mode 100644 erpnext/regional/doctype/uae_vat_account/uae_vat_account.json create mode 100644 erpnext/regional/doctype/uae_vat_account/uae_vat_account.py create mode 100644 erpnext/regional/doctype/uae_vat_setting/__init__.py create mode 100644 erpnext/regional/doctype/uae_vat_setting/test_uae_vat_setting.py create mode 100644 erpnext/regional/doctype/uae_vat_setting/uae_vat_setting.js create mode 100644 erpnext/regional/doctype/uae_vat_setting/uae_vat_setting.json create mode 100644 erpnext/regional/doctype/uae_vat_setting/uae_vat_setting.py diff --git a/erpnext/regional/doctype/uae_vat_account/__init__.py b/erpnext/regional/doctype/uae_vat_account/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/regional/doctype/uae_vat_account/uae_vat_account.json b/erpnext/regional/doctype/uae_vat_account/uae_vat_account.json new file mode 100644 index 0000000000..73a8169207 --- /dev/null +++ b/erpnext/regional/doctype/uae_vat_account/uae_vat_account.json @@ -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 +} \ No newline at end of file diff --git a/erpnext/regional/doctype/uae_vat_account/uae_vat_account.py b/erpnext/regional/doctype/uae_vat_account/uae_vat_account.py new file mode 100644 index 0000000000..80d6b3a5f1 --- /dev/null +++ b/erpnext/regional/doctype/uae_vat_account/uae_vat_account.py @@ -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 diff --git a/erpnext/regional/doctype/uae_vat_setting/__init__.py b/erpnext/regional/doctype/uae_vat_setting/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/regional/doctype/uae_vat_setting/test_uae_vat_setting.py b/erpnext/regional/doctype/uae_vat_setting/test_uae_vat_setting.py new file mode 100644 index 0000000000..a5f151dc73 --- /dev/null +++ b/erpnext/regional/doctype/uae_vat_setting/test_uae_vat_setting.py @@ -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 diff --git a/erpnext/regional/doctype/uae_vat_setting/uae_vat_setting.js b/erpnext/regional/doctype/uae_vat_setting/uae_vat_setting.js new file mode 100644 index 0000000000..f910e1f662 --- /dev/null +++ b/erpnext/regional/doctype/uae_vat_setting/uae_vat_setting.js @@ -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) { + + // } +}); diff --git a/erpnext/regional/doctype/uae_vat_setting/uae_vat_setting.json b/erpnext/regional/doctype/uae_vat_setting/uae_vat_setting.json new file mode 100644 index 0000000000..e2e2ab8245 --- /dev/null +++ b/erpnext/regional/doctype/uae_vat_setting/uae_vat_setting.json @@ -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 +} \ No newline at end of file diff --git a/erpnext/regional/doctype/uae_vat_setting/uae_vat_setting.py b/erpnext/regional/doctype/uae_vat_setting/uae_vat_setting.py new file mode 100644 index 0000000000..9549de9466 --- /dev/null +++ b/erpnext/regional/doctype/uae_vat_setting/uae_vat_setting.py @@ -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 diff --git a/erpnext/regional/united_arab_emirates/utils.py b/erpnext/regional/united_arab_emirates/utils.py index 5242c63e63..4424d2efec 100644 --- a/erpnext/regional/united_arab_emirates/utils.py +++ b/erpnext/regional/united_arab_emirates/utils.py @@ -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