fix: stock settings save issue

This commit is contained in:
Rohit Waghchaure
2025-07-09 11:40:43 +05:30
parent b937b18e3d
commit 64ae1ec367

View File

@@ -121,7 +121,11 @@ class StockSettings(Document):
)
def cant_change_valuation_method(self):
previous_valuation_method = self.get_doc_before_save().get("valuation_method")
doc_before_save = self.get_doc_before_save()
if not doc_before_save:
return
previous_valuation_method = doc_before_save.get("valuation_method")
if previous_valuation_method and previous_valuation_method != self.valuation_method:
# check if there are any stock ledger entries against items