From 7aefc15352221e5c7614956a10bb76bc25113655 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Tue, 26 Mar 2019 15:09:29 +0530 Subject: [PATCH] fix: Allow to add child account if ignore validation checked --- erpnext/accounts/doctype/account/account_tree.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js index df0486cc271..6b35fcbc0be 100644 --- a/erpnext/accounts/doctype/account/account_tree.js +++ b/erpnext/accounts/doctype/account/account_tree.js @@ -23,6 +23,10 @@ frappe.treeview_settings["Account"] = { if(r.message) { 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; + }) } } }); @@ -133,9 +137,10 @@ frappe.treeview_settings["Account"] = { { label:__("Add Child"), condition: function(node) { - return frappe.boot.user.can_create.indexOf("Account") !== -1 && - !frappe.treeview_settings['Account'].treeview.page.fields_dict.root_company.get_value() && - node.expandable && !node.hide_add; + return frappe.boot.user.can_create.indexOf("Account") !== -1 + && (!frappe.treeview_settings['Account'].treeview.page.fields_dict.root_company.get_value() + || frappe.flags.ignore_root_company_validation) + && node.expandable && !node.hide_add; }, click: function() { var me = frappe.treeview_settings['Account'].treeview;