From e94f0b1ccaa6b2cf96c67cd4013c76343b668ff3 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Sun, 2 Mar 2025 12:36:17 +0530 Subject: [PATCH] fix: incorrect batch picked (cherry picked from commit d2564cad684d998dac15995017d79566525dee3c) --- erpnext/public/js/utils/serial_no_batch_selector.js | 2 ++ erpnext/stock/serial_batch_bundle.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js index de1faf36ef5..e02d7a3d785 100644 --- a/erpnext/public/js/utils/serial_no_batch_selector.js +++ b/erpnext/public/js/utils/serial_no_batch_selector.js @@ -540,6 +540,8 @@ erpnext.SerialBatchPackageSelector = class SerialNoBatchBundleUpdate { has_batch_no: this.item.has_batch_no, qty: qty, based_on: based_on, + posting_date: this.frm.doc.posting_date, + posting_time: this.frm.doc.posting_time, }, callback: (r) => { if (r.message) { diff --git a/erpnext/stock/serial_batch_bundle.py b/erpnext/stock/serial_batch_bundle.py index 993d918f8bc..c88df01665f 100644 --- a/erpnext/stock/serial_batch_bundle.py +++ b/erpnext/stock/serial_batch_bundle.py @@ -1006,6 +1006,10 @@ class SerialBatchCreation: elif self.has_serial_no and not self.get("serial_nos"): self.serial_nos = get_serial_nos_for_outward(kwargs) elif not self.has_serial_no and self.has_batch_no and not self.get("batches"): + if self.get("posting_date"): + kwargs["posting_date"] = self.get("posting_date") + kwargs["posting_time"] = self.get("posting_time") + self.batches = get_available_batches(kwargs) def set_auto_serial_batch_entries_for_inward(self):