From abb896ecf1e7336ddda7b9a993134dc6cefb440c 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 c2c553457b0..b2b898eec0d 100644 --- a/erpnext/stock/doctype/warehouse/warehouse.py +++ b/erpnext/stock/doctype/warehouse/warehouse.py @@ -73,7 +73,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)