From 0ff7465e278893442ac4e2f7520440261d263949 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 11 Apr 2025 19:17:47 +0530 Subject: [PATCH] fix: condition for use_batchwise_valuation (cherry picked from commit cc171d970665990b455a3334f7c9e110d232108a) --- erpnext/stock/doctype/batch/batch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index 3c46fcb5aad..800d4f70c40 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -160,7 +160,9 @@ class Batch(Document): from erpnext.stock.utils import get_valuation_method if self.is_new(): - if frappe.db.get_single_value("Stock Settings", "do_not_use_batchwise_valuation"): + if get_valuation_method(self.item) == "Moving Average" and frappe.db.get_single_value( + "Stock Settings", "do_not_use_batchwise_valuation" + ): self.use_batchwise_valuation = 0 return