From e9c1a09af3a6ffbe000cddd89bcb05b38868ea11 Mon Sep 17 00:00:00 2001 From: Nishka Gosalia <58264710+nishkagosalia@users.noreply.github.com> Date: Thu, 9 Apr 2026 15:57:22 +0530 Subject: [PATCH] fix: update_nsm only in warehouse creation (#54165) (cherry picked from commit b0e3fa3979e6efe6c9d230ac7e0812832b4563d2) --- erpnext/stock/doctype/warehouse/warehouse.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py index a1991dd9c07..a19c35f26fa 100644 --- a/erpnext/stock/doctype/warehouse/warehouse.py +++ b/erpnext/stock/doctype/warehouse/warehouse.py @@ -65,7 +65,8 @@ class Warehouse(NestedSet): self.warn_about_multiple_warehouse_account() def on_update(self): - self.update_nsm_model() + if self.is_new() or self.has_value_changed("parent_warehouse"): + self.update_nsm_model() def update_nsm_model(self): frappe.utils.nestedset.update_nsm(self)