Merge pull request #48621 from mihir-kandoi/fix-get-batch-against-sales-order-2

fix: possible issue in getting reserved batch against sales order
This commit is contained in:
Mihir Kandoi
2025-07-16 10:21:25 +05:30
committed by GitHub

View File

@@ -2214,13 +2214,14 @@ def get_auto_batch_nos(kwargs):
if batches:
kwargs.batch_no = batches
kwargs.warehouse = warehouses
available_batches = get_available_batches(kwargs)
qty = flt(kwargs.qty)
available_batches = get_available_batches(kwargs)
stock_ledgers_batches = get_stock_ledgers_batches(kwargs)
pos_invoice_batches = get_reserved_batches_for_pos(kwargs)
sre_reserved_batches = get_reserved_batches_for_sre(kwargs)
kwargs.batch_no = kwargs.warehouse = None
if kwargs.against_sales_order and only_consider_batches:
kwargs.batch_no = kwargs.warehouse = None
picked_batches = frappe._dict()
if kwargs.get("is_pick_list"):
@@ -2245,6 +2246,8 @@ def get_auto_batch_nos(kwargs):
precision = frappe.get_precision("Stock Ledger Entry", "actual_qty")
available_batches = [d for d in available_batches if flt(d.qty, precision) > 0]
qty = flt(kwargs.qty)
if not qty:
return available_batches