diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py index 0787a1f5e83..b31c5d65290 100644 --- a/erpnext/accounts/doctype/account/account.py +++ b/erpnext/accounts/doctype/account/account.py @@ -205,12 +205,10 @@ class Account(Document): return new_account def after_rename(self, old, new, merge=False): + super(Account, self).after_rename(old, new, merge) + if not merge: - frappe.db.set_value("Account", new, "account_name", - " - ".join(new.split(" - ")[:-1])) - else: - from frappe.utils.nestedset import rebuild_tree - rebuild_tree("Account", "parent_account") + frappe.db.set_value("Account", new, "account_name", " - ".join(new.split(" - ")[:-1])) def get_parent_account(doctype, txt, searchfield, start, page_len, filters): return frappe.db.sql("""select name from tabAccount diff --git a/erpnext/accounts/doctype/cost_center/cost_center.py b/erpnext/accounts/doctype/cost_center/cost_center.py index 12d5e19b7d3..55388a5d106 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center.py +++ b/erpnext/accounts/doctype/cost_center/cost_center.py @@ -59,9 +59,8 @@ class CostCenter(NestedSet): return new_cost_center def after_rename(self, olddn, newdn, merge=False): + super(CostCenter, self).after_rename(olddn, newdn, merge) + if not merge: frappe.db.set_value("Cost Center", newdn, "cost_center_name", " - ".join(newdn.split(" - ")[:-1])) - else: - super(CostCenter, self).after_rename(olddn, newdn, merge) - diff --git a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json index f0399b0a690..08bbf8d6b64 100644 --- a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json +++ b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json @@ -1,5 +1,5 @@ { - "add_total_row": 0, + "add_total_row": 1, "apply_user_permissions": 1, "creation": "2013-07-30 17:28:49", "disabled": 0, @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 3, "is_standard": "Yes", - "modified": "2017-02-24 20:20:20.613388", + "modified": "2017-11-06 13:04:36.338268", "modified_by": "Administrator", "module": "Accounts", "name": "Delivered Items To Be Billed", diff --git a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json index db3c9d2ca24..c983dc96295 100644 --- a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json +++ b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json @@ -1,5 +1,5 @@ { - "add_total_row": 0, + "add_total_row": 1, "apply_user_permissions": 1, "creation": "2013-02-21 14:26:44", "disabled": 0, @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 3, "is_standard": "Yes", - "modified": "2017-02-24 20:20:13.972178", + "modified": "2017-11-06 13:04:51.559061", "modified_by": "Administrator", "module": "Accounts", "name": "Ordered Items To Be Billed", diff --git a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json index 906481fa742..64eb984833f 100644 --- a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json +++ b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json @@ -1,5 +1,5 @@ { - "add_total_row": 0, + "add_total_row": 1, "apply_user_permissions": 1, "creation": "2013-07-30 18:35:10", "disabled": 0, @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 3, "is_standard": "Yes", - "modified": "2017-02-24 19:59:52.887744", + "modified": "2017-11-06 13:04:26.094432", "modified_by": "Administrator", "module": "Accounts", "name": "Received Items To Be Billed", diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py index 2766ba067fa..a4c377e8cc0 100644 --- a/erpnext/setup/doctype/item_group/item_group.py +++ b/erpnext/setup/doctype/item_group/item_group.py @@ -47,9 +47,6 @@ class ItemGroup(NestedSet, WebsiteGenerator): return self.route - def after_rename(self, olddn, newdn, merge=False): - NestedSet.after_rename(self, olddn, newdn, merge) - def on_trash(self): NestedSet.on_trash(self) WebsiteGenerator.on_trash(self) diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py index b0335d7d3f2..4f7cf0b286d 100644 --- a/erpnext/stock/doctype/warehouse/warehouse.py +++ b/erpnext/stock/doctype/warehouse/warehouse.py @@ -64,6 +64,8 @@ class Warehouse(NestedSet): where parent_warehouse = %s""", self.name) def before_rename(self, old_name, new_name, merge=False): + super(Warehouse, self).before_rename(old_name, new_name, merge) + # Add company abbr if not provided new_warehouse = erpnext.encode_company_abbr(new_name, self.company) @@ -77,12 +79,14 @@ class Warehouse(NestedSet): return new_warehouse def after_rename(self, old_name, new_name, merge=False): + super(Warehouse, self).after_rename(old_name, new_name, merge) + new_warehouse_name = self.get_new_warehouse_name_without_abbr(new_name) self.db_set("warehouse_name", new_warehouse_name) - + if merge: self.recalculate_bin_qty(new_name) - + def get_new_warehouse_name_without_abbr(self, name): company_abbr = frappe.db.get_value("Company", self.company, "abbr") parts = name.rsplit(" - ", 1) diff --git a/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json b/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json index ed48a0fbd52..58b1be43454 100644 --- a/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json +++ b/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json @@ -1,5 +1,5 @@ { - "add_total_row": 0, + "add_total_row": 1, "apply_user_permissions": 1, "creation": "2013-02-22 18:01:55", "disabled": 0, @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 3, "is_standard": "Yes", - "modified": "2017-09-18 12:28:49.322622", + "modified": "2017-11-06 13:05:38.965229", "modified_by": "Administrator", "module": "Stock", "name": "Ordered Items To Be Delivered",