From f2af2fe63bd467f0e871761dc4e58e223b1937ea Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 10 Jul 2025 21:39:23 +0530 Subject: [PATCH] fix: incorrect last sle for no batch wise valuation (cherry picked from commit 93d3eb662fbe9516de0ccf7b0d101d80fc1c2d57) --- erpnext/stock/deprecated_serial_batch.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/stock/deprecated_serial_batch.py b/erpnext/stock/deprecated_serial_batch.py index a8e17993c30..11e0d0964f0 100644 --- a/erpnext/stock/deprecated_serial_batch.py +++ b/erpnext/stock/deprecated_serial_batch.py @@ -284,6 +284,12 @@ class DeprecatedBatchNoValuation: if self.sle.name: query = query.where(sle.name != self.sle.name) + if self.sle.serial_and_batch_bundle: + query = query.where( + (sle.serial_and_batch_bundle != self.sle.serial_and_batch_bundle) + | (sle.serial_and_batch_bundle.isnull()) + ) + data = query.run(as_dict=True) return data[0] if data else frappe._dict()