diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index e8f5bd91c6..14d6d4225a 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -4,7 +4,6 @@ frappe.provide("erpnext.stock"); frappe.ui.form.on('Stock Entry', { setup: function(frm) { - frm.set_query('production_order', function() { return { filters: [ @@ -15,6 +14,26 @@ frappe.ui.form.on('Stock Entry', { } }); + frappe.db.get_value('Stock Settings', {name: 'Stock Settings'}, 'sample_retention_warehouse', (r) => { + if (r.sample_retention_warehouse) { + var filters = [ + ["Warehouse", 'company', '=', frm.doc.company], + ["Warehouse", "is_group", "=",0], + ['Warehouse', 'name', '!=', r.sample_retention_warehouse] + ] + frm.set_query("from_warehouse", function() { + return { + filters: filters + }; + }); + frm.set_query("s_warehouse", "items", function() { + return { + filters: filters + }; + }); + } + }); + frm.set_query('batch_no', 'items', function(doc, cdt, cdn) { var item = locals[cdt][cdn]; if(!item.item_code) { @@ -39,7 +58,6 @@ frappe.ui.form.on('Stock Entry', { } }); }, - refresh: function(frm) { if(!frm.doc.docstatus) { frm.add_custom_button(__('Make Material Request'), function() {