From fb7c2caf29563d516a66fe6a6587263a10d508fd Mon Sep 17 00:00:00 2001 From: Sudharsanan Ashok <135326972+Sudharsanan11@users.noreply.github.com> Date: Fri, 14 Aug 2026 19:25:35 +0530 Subject: [PATCH] fix(stock): honour pick serial / batch based on in the batch selector (#58176) --- .../public/js/utils/serial_no_batch_selector.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js index b938b5a2b42..95a2278e2c8 100644 --- a/erpnext/public/js/utils/serial_no_batch_selector.js +++ b/erpnext/public/js/utils/serial_no_batch_selector.js @@ -8,6 +8,16 @@ erpnext.SerialBatchPackageSelector = class SerialNoBatchBundleUpdate { ? this.item.rejected_serial_and_batch_bundle : this.item.serial_and_batch_bundle; + this.init(); + } + + async init() { + try { + this.based_on = await erpnext.stock.get_pick_serial_batch_based_on(); + } catch (e) { + this.based_on = "FIFO"; + } + this.make(); this.render_data(); } @@ -391,7 +401,7 @@ erpnext.SerialBatchPackageSelector = class SerialNoBatchBundleUpdate { { fieldtype: "Select", options: ["FIFO", "LIFO", "Expiry"], - default: "FIFO", + default: this.based_on, fieldname: "based_on", label: __("Fetch Based On"), onchange: () => this.get_auto_data(), @@ -537,7 +547,7 @@ erpnext.SerialBatchPackageSelector = class SerialNoBatchBundleUpdate { } if (!based_on) { - based_on = "FIFO"; + based_on = this.based_on; } let warehouse = this.item.warehouse || this.item.s_warehouse;