fix: stock settings save issue

(cherry picked from commit 64ae1ec367)
This commit is contained in:
Rohit Waghchaure
2025-07-09 11:40:43 +05:30
committed by Mergify
parent 243b533150
commit a5c49d1e08

View File

@@ -120,7 +120,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