From 3eeb1cacb0aef9716e0b32848c2b775b81e32f8b Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Tue, 26 Mar 2019 17:18:06 +0530 Subject: [PATCH] fix: Change name to Allow Account Creation against Child Company in company master --- erpnext/accounts/doctype/account/account.py | 5 ++--- erpnext/accounts/doctype/account/account_tree.js | 4 ++-- erpnext/setup/doctype/company/company.json | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py index 9b698b40c1..ac74b4516a 100644 --- a/erpnext/accounts/doctype/account/account.py +++ b/erpnext/accounts/doctype/account/account.py @@ -96,11 +96,10 @@ class Account(NestedSet): if frappe.local.flags.ignore_root_company_validation or self.flags.ignore_root_company_validation: return - if frappe.get_value("Company", self.company, "ignore_root_company_validation"): - return - ancestors = get_root_company(self.company) if ancestors: + if frappe.get_value("Company", self.company, "allow_account_creation_against_child_company"): + return frappe.throw(_("Please add the account to root level Company - %s" % ancestors[0])) else: descendants = get_descendants_of('Company', self.company) diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js index c98aef83ee..27f5349e2b 100644 --- a/erpnext/accounts/doctype/account/account_tree.js +++ b/erpnext/accounts/doctype/account/account_tree.js @@ -24,8 +24,8 @@ frappe.treeview_settings["Account"] = { let root_company = r.message.length ? r.message[0] : ""; me.page.fields_dict.root_company.set_value(root_company); - frappe.db.get_value("Company", {"name": company}, "ignore_root_company_validation", (r) => { - frappe.flags.ignore_root_company_validation = r.ignore_root_company_validation; + frappe.db.get_value("Company", {"name": company}, "allow_account_creation_against_child_company", (r) => { + frappe.flags.ignore_root_company_validation = r.allow_account_creation_against_child_company; }); } } diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json index 66ea7da6a5..dbd7c4149f 100644 --- a/erpnext/setup/doctype/company/company.json +++ b/erpnext/setup/doctype/company/company.json @@ -1466,7 +1466,7 @@ "columns": 0, "depends_on": "eval:doc.parent_company", "fetch_if_empty": 0, - "fieldname": "ignore_root_company_validation", + "fieldname": "allow_account_creation_against_child_company", "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, @@ -1475,7 +1475,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Ignore Root Company Validation", + "label": "Allow Account Creation Against Child Company", "length": 0, "no_copy": 0, "permlevel": 0, @@ -3093,7 +3093,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2019-03-25 22:13:08.721452", + "modified": "2019-03-26 17:15:50.390548", "modified_by": "Administrator", "module": "Setup", "name": "Company",