From 818ddc0b8c93b6ff31b7ef471a80504c526ac668 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 8 Jul 2025 13:27:10 +0530 Subject: [PATCH] fix: duplicate items being created when fetching items from warehouse in stock reco (cherry picked from commit 73f6c2955934c2282739438ccdd2c1cc954f2407) --- .../doctype/stock_reconciliation/stock_reconciliation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 7bee191b56f..fee71460ee5 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -1262,12 +1262,12 @@ def get_items(warehouse, posting_date, posting_time, company, item_code=None, ig itemwise_batch_data = get_itemwise_batch(warehouse, posting_date, company, item_code) for d in items: - if d.item_code in itemwise_batch_data: + if (d.item_code, d.warehouse) in itemwise_batch_data: valuation_rate = get_stock_balance( d.item_code, d.warehouse, posting_date, posting_time, with_valuation_rate=True )[1] - for row in itemwise_batch_data.get(d.item_code): + for row in itemwise_batch_data.get((d.item_code, d.warehouse)): if ignore_empty_stock and not row.qty: continue @@ -1399,7 +1399,7 @@ def get_itemwise_batch(warehouse, posting_date, company, item_code=None): columns, data = execute(filters) for row in data: - itemwise_batch_data.setdefault(row[0], []).append( + itemwise_batch_data.setdefault((row[0], row[3]), []).append( frappe._dict( { "item_code": row[0],