Merge branch 'version-13-hotfix' of https://github.com/frappe/erpnext into bootstraped_gst_setup
diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
index 927adc7..9b6842d 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
@@ -189,24 +189,6 @@
build_account_tree(tree[child.account_name], child, all_accounts)
@frappe.whitelist()
-def validate_bank_account(coa, bank_account):
- accounts = []
- chart = get_chart(coa)
-
- if chart:
- def _get_account_names(account_master):
- for account_name, child in iteritems(account_master):
- if account_name not in ["account_number", "account_type",
- "root_type", "is_group", "tax_rate"]:
- accounts.append(account_name)
-
- _get_account_names(child)
-
- _get_account_names(chart)
-
- return (bank_account in accounts)
-
-@frappe.whitelist()
def build_tree_from_json(chart_template, chart_data=None):
''' get chart template from its folder and parse the json to be rendered as tree '''
chart = chart_data or get_chart(chart_template)
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 66a9b60..ed6e28d 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -784,7 +784,7 @@
return acc
def create_payment_gateway_account(gateway, payment_channel="Email"):
- from erpnext.setup.setup_wizard.operations.company_setup import create_bank_account
+ from erpnext.setup.setup_wizard.operations.install_fixtures import create_bank_account
company = frappe.db.get_value("Global Defaults", None, "default_company")
if not company:
diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js
index ef03b01..a304572 100644
--- a/erpnext/public/js/setup_wizard.js
+++ b/erpnext/public/js/setup_wizard.js
@@ -139,36 +139,10 @@
},
validate: function () {
- let me = this;
- let exist;
-
if (!this.validate_fy_dates()) {
return false;
}
- // Validate bank name
- if(me.values.bank_account){
- frappe.call({
- async: false,
- method: "erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts.validate_bank_account",
- args: {
- "coa": me.values.chart_of_accounts,
- "bank_account": me.values.bank_account
- },
- callback: function (r) {
- if(r.message){
- exist = r.message;
- me.get_field("bank_account").set_value("");
- let message = __('Account {0} already exists. Please enter a different name for your bank account.',
- [me.values.bank_account]
- );
- frappe.msgprint(message);
- }
- }
- });
- return !exist; // Return False if exist = true
- }
-
return true;
},
diff --git a/erpnext/regional/doctype/gst_settings/gst_settings.py b/erpnext/regional/doctype/gst_settings/gst_settings.py
index bc956e9..af3d92e 100644
--- a/erpnext/regional/doctype/gst_settings/gst_settings.py
+++ b/erpnext/regional/doctype/gst_settings/gst_settings.py
@@ -19,6 +19,21 @@
from tabAddress where country = "India" and ifnull(gstin, '')!='' ''')
self.set_onload('data', data)
+ def validate(self):
+ # Validate duplicate accounts
+ self.validate_duplicate_accounts()
+
+ def validate_duplicate_accounts(self):
+ account_list = []
+ for account in self.get('gst_accounts'):
+ for fieldname in ['cgst_account', 'sgst_account', 'igst_account', 'cess_account']:
+ if account.get(fieldname) in account_list:
+ frappe.throw(_("Account {0} appears multiple times").format(
+ frappe.bold(account.get(fieldname))))
+
+ if account.get(fieldname):
+ account_list.append(account.get(fieldname))
+
@frappe.whitelist()
def send_reminder():
frappe.has_permission('GST Settings', throw=True)
diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py
index 3e0b9b7..5f9d5ed 100644
--- a/erpnext/regional/india/setup.py
+++ b/erpnext/regional/india/setup.py
@@ -25,6 +25,7 @@
frappe.enqueue('erpnext.regional.india.setup.add_hsn_sac_codes', now=frappe.flags.in_test)
create_gratuity_rule()
add_print_formats()
+ update_accounts_settings_for_taxes()
def add_hsn_sac_codes():
if frappe.flags.in_test and frappe.flags.created_hsn_codes:
@@ -680,7 +681,7 @@
def make_fixtures(company=None):
docs = []
- company = company.name if company else frappe.db.get_value("Global Defaults", None, "default_company")
+ company = company or frappe.db.get_value("Global Defaults", None, "default_company")
set_salary_components(docs)
set_tds_account(docs, company)
@@ -698,6 +699,53 @@
# create records for Tax Withholding Category
set_tax_withholding_category(company)
+def update_regional_tax_settings(country, company):
+ # Will only add default GST accounts if present
+ input_account_names = ['Input Tax CGST', 'Input Tax SGST', 'Input Tax IGST']
+ output_account_names = ['Output Tax CGST', 'Output Tax SGST', 'Output Tax IGST']
+ rcm_accounts = ['Input Tax CGST RCM', 'Input Tax SGST RCM', 'Input Tax IGST RCM']
+ gst_settings = frappe.get_single('GST Settings')
+ existing_account_list = []
+
+ for account in gst_settings.get('gst_accounts'):
+ for key in ['cgst_account', 'sgst_account', 'igst_account']:
+ existing_account_list.append(account.get(key))
+
+ gst_accounts = frappe._dict(frappe.get_all("Account",
+ {'company': company, 'account_name': ('in', input_account_names +
+ output_account_names + rcm_accounts)}, ['account_name', 'name'], as_list=1))
+
+ add_accounts_in_gst_settings(company, input_account_names, gst_accounts,
+ existing_account_list, gst_settings)
+ add_accounts_in_gst_settings(company, output_account_names, gst_accounts,
+ existing_account_list, gst_settings)
+ add_accounts_in_gst_settings(company, rcm_accounts, gst_accounts,
+ existing_account_list, gst_settings, is_reverse_charge=1)
+
+ gst_settings.save()
+
+def add_accounts_in_gst_settings(company, account_names, gst_accounts,
+ existing_account_list, gst_settings, is_reverse_charge=0):
+ accounts_not_added = 1
+
+ for account in account_names:
+ # Default Account Added does not exists
+ if not gst_accounts.get(account):
+ accounts_not_added = 0
+
+ # Check if already added in GST Settings
+ if gst_accounts.get(account) in existing_account_list:
+ accounts_not_added = 0
+
+ if accounts_not_added:
+ gst_settings.append('gst_accounts', {
+ 'company': company,
+ 'cgst_account': gst_accounts.get(account_names[0]),
+ 'sgst_account': gst_accounts.get(account_names[1]),
+ 'igst_account': gst_accounts.get(account_names[2]),
+ 'is_reverse_charge_account': is_reverse_charge
+ })
+
def set_salary_components(docs):
docs.extend([
{'doctype': 'Salary Component', 'salary_component': 'Professional Tax',
@@ -731,12 +779,13 @@
docs = get_tds_details(accounts, fiscal_year)
for d in docs:
- try:
+ if not frappe.db.exists("Tax Withholding Category", d.get("name")):
doc = frappe.get_doc(d)
+ doc.flags.ignore_validate = True
doc.flags.ignore_permissions = True
doc.flags.ignore_mandatory = True
doc.insert()
- except frappe.DuplicateEntryError:
+ else:
doc = frappe.get_doc("Tax Withholding Category", d.get("name"))
if accounts:
@@ -749,11 +798,12 @@
doc.append("rates", d.get('rates')[0])
doc.flags.ignore_permissions = True
+ doc.flags.ignore_validate = True
doc.flags.ignore_mandatory = True
+ doc.flags.ignore_links = True
doc.save()
def set_tds_account(docs, company):
- abbr = frappe.get_value("Company", company, "abbr")
parent_account = frappe.db.get_value("Account", filters = {"account_name": "Duties and Taxes", "company": company})
if parent_account:
docs.extend([
@@ -912,7 +962,6 @@
]
def create_gratuity_rule():
-
# Standard Indain Gratuity Rule
if not frappe.db.exists("Gratuity Rule", "Indian Standard Gratuity Rule"):
rule = frappe.new_doc("Gratuity Rule")
@@ -930,3 +979,7 @@
rule.flags.ignore_mandatory = True
rule.save()
+
+def update_accounts_settings_for_taxes():
+ if frappe.db.count('Company') == 1:
+ frappe.db.set_value('Accounts Settings', None, "add_taxes_from_item_tax_template", 0)
\ No newline at end of file
diff --git a/erpnext/regional/report/e_invoice_summary/e_invoice_summary.json b/erpnext/regional/report/e_invoice_summary/e_invoice_summary.json
index 4deb073..d0000ad 100644
--- a/erpnext/regional/report/e_invoice_summary/e_invoice_summary.json
+++ b/erpnext/regional/report/e_invoice_summary/e_invoice_summary.json
@@ -11,7 +11,7 @@
"is_standard": "Yes",
"json": "{}",
"letter_head": "Logo",
- "modified": "2021-03-12 12:36:48.689413",
+ "modified": "2021-03-13 12:36:48.689413",
"modified_by": "Administrator",
"module": "Regional",
"name": "E-Invoice Summary",
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 27e023c..2a9995b 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -110,7 +110,7 @@
self.create_default_warehouses()
if frappe.flags.country_change:
- install_country_fixtures(self.name)
+ install_country_fixtures(self.name, self.country)
self.create_default_tax_template()
if not frappe.db.get_value("Department", {"company": self.name}):
@@ -435,16 +435,15 @@
return " - ".join(parts)
-def install_country_fixtures(company):
- company_doc = frappe.get_doc("Company", company)
- path = frappe.get_app_path('erpnext', 'regional', frappe.scrub(company_doc.country))
+def install_country_fixtures(company, country):
+ path = frappe.get_app_path('erpnext', 'regional', frappe.scrub(country))
if os.path.exists(path.encode("utf-8")):
try:
- module_name = "erpnext.regional.{0}.setup.setup".format(frappe.scrub(company_doc.country))
- frappe.get_attr(module_name)(company_doc, False)
+ module_name = "erpnext.regional.{0}.setup.setup".format(frappe.scrub(country))
+ frappe.get_attr(module_name)(company, False)
except Exception as e:
frappe.log_error()
- frappe.throw(_("Failed to setup defaults for country {0}. Please contact support@erpnext.com").format(frappe.bold(company_doc.country)))
+ frappe.throw(_("Failed to setup defaults for country {0}. Please contact support@erpnext.com").format(frappe.bold(country)))
def update_company_current_month_sales(company):
diff --git a/erpnext/setup/setup_wizard/data/country_wise_tax.json b/erpnext/setup/setup_wizard/data/country_wise_tax.json
index daaa626..6df57f1 100644
--- a/erpnext/setup/setup_wizard/data/country_wise_tax.json
+++ b/erpnext/setup/setup_wizard/data/country_wise_tax.json
@@ -1166,31 +1166,266 @@
"India": {
"chart_of_accounts": {
"*": {
+ "tax_categories": [
+ {
+ "title": "In-State",
+ "is_inter_state": 0,
+ "gst_state": ""
+ },
+ {
+ "title": "Out-State",
+ "is_inter_state": 1,
+ "gst_state": ""
+ },
+ {
+ "title": "Reverse Charge In-State",
+ "is_inter_state": 0,
+ "gst_state": ""
+ },
+ {
+ "title": "Reverse Charge Out-State",
+ "is_inter_state": 0,
+ "gst_state": ""
+ },
+ {
+ "title": "Registered Composition",
+ "is_inter_state": 0,
+ "gst_state": ""
+ }
+ ],
"item_tax_templates": [
{
- "title": "In State GST",
+ "title": "GST 9%",
"taxes": [
{
"tax_type": {
- "account_name": "SGST",
+ "account_name": "Output Tax SGST",
"tax_rate": 9.00
}
},
{
"tax_type": {
- "account_name": "CGST",
+ "account_name": "Output Tax CGST",
"tax_rate": 9.00
}
+ },
+ {
+ "tax_type": {
+ "account_name": "Output Tax IGST",
+ "tax_rate": 18.00
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax SGST",
+ "tax_rate": 9.00
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax CGST",
+ "tax_rate": 9.00
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax IGST",
+ "tax_rate": 18.00
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax SGST RCM",
+ "tax_rate": 9.00
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax CGST RCM",
+ "tax_rate": 9.00
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax IGST RCM",
+ "tax_rate": 18.00
+ }
}
]
},
{
- "title": "Out of State GST",
+ "title": "GST 5%",
"taxes": [
{
"tax_type": {
- "account_name": "IGST",
- "tax_rate": 18.00
+ "account_name": "Output Tax SGST",
+ "tax_rate": 2.5
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Output Tax CGST",
+ "tax_rate": 2.5
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Output Tax IGST",
+ "tax_rate": 5.0
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax SGST",
+ "tax_rate": 2.5
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax CGST",
+ "tax_rate": 2.5
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax IGST",
+ "tax_rate": 5.0
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax SGST RCM",
+ "tax_rate": 2.50
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax CGST RCM",
+ "tax_rate": 2.50
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax IGST RCM",
+ "tax_rate": 5.00
+ }
+ }
+ ]
+ },
+ {
+ "title": "GST 12%",
+ "taxes": [
+ {
+ "tax_type": {
+ "account_name": "Output Tax SGST",
+ "tax_rate": 6.0
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Output Tax CGST",
+ "tax_rate": 6.0
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Output Tax IGST",
+ "tax_rate": 12.0
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax SGST",
+ "tax_rate": 6.0
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax CGST",
+ "tax_rate": 6.0
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax IGST",
+ "tax_rate": 12.0
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax SGST RCM",
+ "tax_rate": 6.00
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax CGST RCM",
+ "tax_rate": 6.00
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax IGST RCM",
+ "tax_rate": 12.00
+ }
+ }
+ ]
+ },
+ {
+ "title": "GST 28%",
+ "taxes": [
+ {
+ "tax_type": {
+ "account_name": "Output Tax SGST",
+ "tax_rate": 14.0
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Output Tax CGST",
+ "tax_rate": 14.0
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Output Tax IGST",
+ "tax_rate": 28.0
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax SGST",
+ "tax_rate": 14.0
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax CGST",
+ "tax_rate": 14.0
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax IGST",
+ "tax_rate": 28.0
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax SGST RCM",
+ "tax_rate": 14.00
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax CGST RCM",
+ "tax_rate": 14.00
+ }
+ },
+ {
+ "tax_type": {
+ "account_name": "Input Tax IGST RCM",
+ "tax_rate": 28.00
}
}
]
@@ -1229,36 +1464,117 @@
]
}
],
- "*": [
+ "sales_tax_templates": [
{
- "title": "In State GST",
+ "title": "Output GST In-state",
"taxes": [
{
"account_head": {
- "account_name": "SGST",
- "tax_rate": 9.00
+ "account_name": "Output Tax SGST",
+ "tax_rate": 9.00,
+ "account_type": "Tax"
}
},
{
"account_head": {
- "account_name": "CGST",
- "tax_rate": 9.00
+ "account_name": "Output Tax CGST",
+ "tax_rate": 9.00,
+ "account_type": "Tax"
}
}
- ]
+ ],
+ "tax_category": "In-State"
},
{
- "title": "Out of State GST",
+ "title": "Output GST Out-state",
"taxes": [
{
"account_head": {
- "account_name": "IGST",
- "tax_rate": 18.00
+ "account_name": "Output Tax IGST",
+ "tax_rate": 18.00,
+ "account_type": "Tax"
}
}
- ]
+ ],
+ "tax_category": "Out-State"
+ }
+ ],
+ "purchase_tax_templates": [
+ {
+ "title": "Input GST In-state",
+ "taxes": [
+ {
+ "account_head": {
+ "account_name": "Input Tax SGST",
+ "tax_rate": 9.00,
+ "root_type": "Asset",
+ "account_type": "Tax"
+ }
+ },
+ {
+ "account_head": {
+ "account_name": "Input Tax CGST",
+ "tax_rate": 9.00,
+ "root_type": "Asset",
+ "account_type": "Tax"
+ }
+ }
+ ],
+ "tax_category": "In-State"
},
{
+ "title": "Input GST Out-state",
+ "taxes": [
+ {
+ "account_head": {
+ "account_name": "Input Tax IGST",
+ "tax_rate": 18.00,
+ "root_type": "Asset",
+ "account_type": "Tax"
+ }
+ }
+ ],
+ "tax_category": "Out-State"
+ },
+ {
+ "title": "Input GST RCM In-state",
+ "taxes": [
+ {
+ "account_head": {
+ "account_name": "Input Tax SGST RCM",
+ "tax_rate": 9.00,
+ "root_type": "Asset",
+ "account_type": "Tax"
+ }
+ },
+ {
+ "account_head": {
+ "account_name": "Input Tax CGST RCM",
+ "tax_rate": 9.00,
+ "root_type": "Asset",
+ "account_type": "Tax"
+ }
+ }
+ ],
+ "tax_category": "Reverse Charge In-State"
+ },
+ {
+ "title": "Input GST RCM Out-state",
+ "taxes": [
+ {
+ "account_head": {
+ "account_name": "Input Tax IGST RCM",
+ "tax_rate": 18.00,
+ "root_type": "Asset",
+ "account_type": "Tax"
+ }
+ }
+ ],
+ "tax_category": "Reverse Charge Out-State"
+ }
+ ],
+ "*": [
+ {
"title": "VAT 5%",
"taxes": [
{
@@ -1349,7 +1665,7 @@
"Italy VAT 4%":{
"account_name": "IVA 4%",
"tax_rate": 4.00
- }
+ }
},
"Ivory Coast": {
diff --git a/erpnext/setup/setup_wizard/operations/company_setup.py b/erpnext/setup/setup_wizard/operations/company_setup.py
index 3f0bb14..4edf948 100644
--- a/erpnext/setup/setup_wizard/operations/company_setup.py
+++ b/erpnext/setup/setup_wizard/operations/company_setup.py
@@ -42,29 +42,6 @@
'quotation_series': "QTN-",
}).insert()
-def create_bank_account(args):
- if args.get("bank_account"):
- company_name = args.get('company_name')
- bank_account_group = frappe.db.get_value("Account",
- {"account_type": "Bank", "is_group": 1, "root_type": "Asset",
- "company": company_name})
- if bank_account_group:
- bank_account = frappe.get_doc({
- "doctype": "Account",
- 'account_name': args.get("bank_account"),
- 'parent_account': bank_account_group,
- 'is_group':0,
- 'company': company_name,
- "account_type": "Bank",
- })
- try:
- return bank_account.insert()
- except RootNotEditable:
- frappe.throw(_("Bank account cannot be named as {0}").format(args.get("bank_account")))
- except frappe.DuplicateEntryError:
- # bank account same as a CoA entry
- pass
-
def create_email_digest():
from frappe.utils.user import get_system_managers
system_managers = get_system_managers(only_name=True)
diff --git a/erpnext/setup/setup_wizard/operations/taxes_setup.py b/erpnext/setup/setup_wizard/operations/taxes_setup.py
index f4fe18e..a664914 100644
--- a/erpnext/setup/setup_wizard/operations/taxes_setup.py
+++ b/erpnext/setup/setup_wizard/operations/taxes_setup.py
@@ -27,6 +27,7 @@
country_wise_tax = simple_to_detailed(country_wise_tax)
from_detailed_data(company_name, country_wise_tax)
+ update_regional_tax_settings(country, company_name)
def simple_to_detailed(templates):
@@ -101,6 +102,17 @@
make_item_tax_template(company_name, template)
+def update_regional_tax_settings(country, company):
+ path = frappe.get_app_path('erpnext', 'regional', frappe.scrub(country))
+ if os.path.exists(path.encode("utf-8")):
+ try:
+ module_name = "erpnext.regional.{0}.setup.update_regional_tax_settings".format(frappe.scrub(country))
+ frappe.get_attr(module_name)(country, company)
+ except Exception as e:
+ # Log error and ignore if failed to setup regional tax settings
+ frappe.log_error()
+ pass
+
def make_taxes_and_charges_template(company_name, doctype, template):
template['company'] = company_name
template['doctype'] = doctype
@@ -130,8 +142,11 @@
if fieldname not in tax_row:
tax_row[fieldname] = default_value
- return frappe.get_doc(template).insert(ignore_permissions=True)
-
+ doc = frappe.get_doc(template)
+ doc.flags.ignore_links = True
+ doc.flags.ignore_validate = True
+ doc.insert(ignore_permissions=True)
+ return doc
def make_item_tax_template(company_name, template):
"""Create an Item Tax Template.
@@ -156,8 +171,21 @@
if 'tax_rate' not in tax_row:
tax_row['tax_rate'] = account_data.get('tax_rate')
- return frappe.get_doc(template).insert(ignore_permissions=True)
+ doc = frappe.get_doc(template)
+ doc.flags.ignore_links = True
+ doc.flags.ignore_validate = True
+ doc.insert(ignore_permissions=True)
+ return doc
+def make_tax_category(tax_category):
+ """ Make tax category based on title if not already created """
+ doctype = 'Tax Category'
+ if not frappe.db.exists(doctype, tax_category['title']):
+ tax_category['doctype'] = doctype
+ doc = frappe.get_doc(tax_category)
+ doc.flags.ignore_links = True
+ doc.flags.ignore_validate = True
+ doc.insert(ignore_permissions=True)
def get_or_create_account(company_name, account):
"""
@@ -169,12 +197,14 @@
existing_accounts = frappe.get_list('Account',
filters={
- 'company': company_name,
- 'root_type': root_type
+ 'account_name': account.get('account_name'),
+ 'account_number': account.get('account_number', ''),
+ 'company': company_name
},
or_filters={
- 'account_name': account.get('account_name'),
- 'account_number': account.get('account_number')
+ 'company': company_name,
+ 'root_type': root_type,
+ 'is_group': 0
}
)
@@ -191,8 +221,11 @@
account['root_type'] = root_type
account['is_group'] = 0
- return frappe.get_doc(account).insert(ignore_permissions=True, ignore_mandatory=True)
-
+ doc = frappe.get_doc(account)
+ doc.flags.ignore_links = True
+ doc.flags.ignore_validate = True
+ doc.insert(ignore_permissions=True, ignore_mandatory=True)
+ return doc
def get_or_create_tax_group(company_name, root_type):
# Look for a group account of type 'Tax'
@@ -237,7 +270,11 @@
'account_type': 'Tax',
'account_name': account_name,
'parent_account': root_account.name
- }).insert(ignore_permissions=True)
+ })
+
+ tax_group_account.flags.ignore_links = True
+ tax_group_account.flags.ignore_validate = True
+ tax_group_account.insert(ignore_permissions=True)
tax_group_name = tax_group_account.name