fix: incorrect last sle for no batch wise valuation

(cherry picked from commit 93d3eb662f)
This commit is contained in:
Rohit Waghchaure
2025-07-10 21:39:23 +05:30
committed by Mergify
parent 76fe861281
commit f2af2fe63b

View File

@@ -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()