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 078b0d9883993bfe748de25ab9d0644f48361026..2cc667528bdb23f93087984f2470cc4f629b7010 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 @@ -77,7 +77,7 @@ def create_charts( # after all accounts are already inserted. frappe.local.flags.ignore_update_nsm = True _import_accounts(chart, None, None, root_account=True) - rebuild_tree("Account", "parent_account") + rebuild_tree("Account") frappe.local.flags.ignore_update_nsm = False diff --git a/erpnext/patches/v11_0/create_department_records_for_each_company.py b/erpnext/patches/v11_0/create_department_records_for_each_company.py index 250a124a010c6d4d15aae71c721eeb4730464a71..c2bc790d777f9428b1c05e85f36129db5dc147a9 100644 --- a/erpnext/patches/v11_0/create_department_records_for_each_company.py +++ b/erpnext/patches/v11_0/create_department_records_for_each_company.py @@ -35,7 +35,7 @@ def execute(): # append list of new department for each company comp_dict[company.name][department.name] = copy_doc.name - rebuild_tree("Department", "parent_department") + rebuild_tree("Department") doctypes = ["Asset", "Employee", "Payroll Entry", "Staffing Plan", "Job Opening"] for d in doctypes: diff --git a/erpnext/patches/v11_0/make_location_from_warehouse.py b/erpnext/patches/v11_0/make_location_from_warehouse.py index c863bb7ecf7c6fdc48b860b8b9ba9003a4ccfb82..8d9c8d8ef6c5047bec5623d62b4b278b22c48719 100644 --- a/erpnext/patches/v11_0/make_location_from_warehouse.py +++ b/erpnext/patches/v11_0/make_location_from_warehouse.py @@ -27,7 +27,7 @@ def execute(): except frappe.DuplicateEntryError: continue - rebuild_tree("Location", "parent_location") + rebuild_tree("Location") def get_parent_warehouse_name(warehouse): diff --git a/erpnext/patches/v11_0/rebuild_tree_for_company.py b/erpnext/patches/v11_0/rebuild_tree_for_company.py index fc06c5d30d9c3a4832b49a89e98e27581a499a51..a9b23445e9f3df6667b86c3b0e727776eba15027 100644 --- a/erpnext/patches/v11_0/rebuild_tree_for_company.py +++ b/erpnext/patches/v11_0/rebuild_tree_for_company.py @@ -4,4 +4,4 @@ from frappe.utils.nestedset import rebuild_tree def execute(): frappe.reload_doc("setup", "doctype", "company") - rebuild_tree("Company", "parent_company") + rebuild_tree("Company") diff --git a/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py b/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py index 96daba7d368ce0738dc70c88a203828e7da6098d..67eb91590261a9eee325342983901faeb9aeec00 100644 --- a/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py +++ b/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py @@ -41,4 +41,4 @@ def build_tree(): } ).insert(ignore_permissions=True) - rebuild_tree("Supplier Group", "parent_supplier_group") + rebuild_tree("Supplier Group") diff --git a/erpnext/patches/v11_0/update_department_lft_rgt.py b/erpnext/patches/v11_0/update_department_lft_rgt.py index 778392ec5fca72cecb3b7d547c02050ac5108618..380ca4d47ab57131223f876521a22703e3a89f04 100644 --- a/erpnext/patches/v11_0/update_department_lft_rgt.py +++ b/erpnext/patches/v11_0/update_department_lft_rgt.py @@ -18,4 +18,4 @@ def execute(): ) ) - rebuild_tree("Department", "parent_department") + rebuild_tree("Department") diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 11eb91297624d0cd9d14866727b042918e742b35..d6c75edbd2769a6258281b51bf299eb601f8e1a9 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -163,7 +163,9 @@ class Company(NestedSet): frappe.local.enable_perpetual_inventory[self.name] = self.enable_perpetual_inventory if frappe.flags.parent_company_changed: - rebuild_tree("Company", "parent_company") + from frappe.utils.nestedset import rebuild_tree + + rebuild_tree("Company") frappe.clear_cache() @@ -310,7 +312,7 @@ class Company(NestedSet): frappe.local.flags.ignore_update_nsm = True make_records(records) frappe.local.flags.ignore_update_nsm = False - rebuild_tree("Department", "parent_department") + rebuild_tree("Department") def validate_coa_input(self): if self.create_chart_of_accounts_based_on == "Existing Company": diff --git a/erpnext/setup/doctype/item_group/test_item_group.py b/erpnext/setup/doctype/item_group/test_item_group.py index ea8c79a3a5bd1f15b710cc5c601ecc825b902639..2a5a883772ba8dee35c23a01b7143a4f4c9d5b6e 100644 --- a/erpnext/setup/doctype/item_group/test_item_group.py +++ b/erpnext/setup/doctype/item_group/test_item_group.py @@ -78,7 +78,7 @@ class TestItem(unittest.TestCase): group_b.save() def test_rebuild_tree(self): - rebuild_tree("Item Group", "parent_item_group") + rebuild_tree("Item Group") self.test_basic_tree() def move_it_back(self): diff --git a/erpnext/stock/__init__.py b/erpnext/stock/__init__.py index 038e2549197edf9c6024cff0446e445f70980f3c..fbc925c748b13da13488ab167780e0997c0d6dde 100644 --- a/erpnext/stock/__init__.py +++ b/erpnext/stock/__init__.py @@ -60,7 +60,7 @@ def get_warehouse_account(warehouse, warehouse_account=None): else: from frappe.utils.nestedset import rebuild_tree - rebuild_tree("Warehouse", "parent_warehouse") + rebuild_tree("Warehouse") else: account = frappe.db.sql( """