fix: allow to change valuation method from FIFO to Moving Average

This commit is contained in:
Rohit Waghchaure
2025-04-26 16:31:37 +05:30
parent 483c4a3271
commit b454ed4b8f

View File

@@ -974,6 +974,11 @@ class Item(Document):
changed_fields = [
field for field in restricted_fields if cstr(self.get(field)) != cstr(values.get(field))
]
# Allow to change valuation method from FIFO to Moving Average not vice versa
if self.valuation_method == "Moving Average" and "valuation_method" in changed_fields:
changed_fields.remove("valuation_method")
if not changed_fields:
return