From dbacfd13b889aa87089bce15c7c887a1367105bf Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 19 May 2026 13:23:32 +0530 Subject: [PATCH] fix: stock balance showing incorrect value because of incorrect SLE (cherry picked from commit 94b95d6c2f9f6f8262ced0018d26d979aa17844c) --- erpnext/stock/stock_ledger.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 9cbce196e94..ffdb97ef9a6 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -2480,7 +2480,9 @@ def get_stock_value_difference( ) if voucher_detail_no: - query = query.where(table.voucher_detail_no != voucher_detail_no) + query = query.where( + (table.voucher_detail_no != voucher_detail_no) | (table.voucher_detail_no.isnull()) + ) elif voucher_no: query = query.where(table.voucher_no != voucher_no)