From 50266d3b6bb899ec9536e6909972a42e164563f4 Mon Sep 17 00:00:00 2001 From: thomasantony12 Date: Sun, 12 Oct 2025 11:18:03 +0530 Subject: [PATCH] fix: Batch ordering based on the method mentioned in settings (cherry picked from commit 7fa800b87449fea05306f2ae31e8e03801e9ead8) --- erpnext/stock/doctype/batch/batch.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index 37530682db4..e81e9a2ff5a 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -253,6 +253,7 @@ def get_batch_qty( get_auto_batch_nos, ) + stock_settings = frappe.get_cached_doc("Stock Settings") batchwise_qty = defaultdict(float) kwargs = frappe._dict( { @@ -262,6 +263,7 @@ def get_batch_qty( "posting_date": posting_date, "posting_time": posting_time, "batch_no": batch_no, + "based_on": stock_settings.pick_serial_and_batch_based_on, "ignore_voucher_nos": ignore_voucher_nos, "for_stock_levels": for_stock_levels, "consider_negative_batches": consider_negative_batches,