From 68809159ba04f870a279bf662a8f941a77e8c8fc Mon Sep 17 00:00:00 2001 From: marination Date: Tue, 2 Nov 2021 15:49:58 +0530 Subject: [PATCH 1/2] fix: Remove warehouse filter on Batch field for Material Receipt (cherry picked from commit 048210a8f67fe0544216361d7342619581318570) --- erpnext/stock/doctype/stock_entry/stock_entry.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index dfd827b62d5..d05368d79c7 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -88,7 +88,9 @@ frappe.ui.form.on('Stock Entry', { } } - filters["warehouse"] = item.s_warehouse || item.t_warehouse; + if (frm.doc.purpose != "Material Receipt") { + filters["warehouse"] = item.s_warehouse || item.t_warehouse; + } return { query : "erpnext.controllers.queries.get_batch_no", From b81dfdcd26cd31c60fab3e26610d8c899615d42c Mon Sep 17 00:00:00 2001 From: marination Date: Tue, 2 Nov 2021 15:57:41 +0530 Subject: [PATCH 2/2] chore: Add comment above fix for future reference (cherry picked from commit 48886ee70524132d1f4cf6751b56ccbc96d765a5) --- erpnext/stock/doctype/stock_entry/stock_entry.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index d05368d79c7..fc9d1ed98f7 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -88,6 +88,8 @@ frappe.ui.form.on('Stock Entry', { } } + // User could want to select a manually created empty batch (no warehouse) + // or a pre-existing batch if (frm.doc.purpose != "Material Receipt") { filters["warehouse"] = item.s_warehouse || item.t_warehouse; }