diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js index b22d5ca4c4..7b04efce28 100644 --- a/erpnext/public/js/utils/serial_no_batch_selector.js +++ b/erpnext/public/js/utils/serial_no_batch_selector.js @@ -373,13 +373,24 @@ erpnext.SerialNoBatchSelector = Class.extend({ get_serial_no_fields: function() { var me = this; this.serial_list = []; + + let serial_no_filters = { + item_code: me.item_code, + delivery_document_no: ["in", ""] + } + + if (me.warehouse_details.name) { + serial_no_filters['warehouse'] = me.warehouse_details.name; + } return [ {fieldtype: 'Section Break', label: __('Serial Numbers')}, { fieldtype: 'Link', fieldname: 'serial_no_select', options: 'Serial No', label: __('Select to add Serial Number.'), get_query: function() { - return { filters: {item_code: me.item_code, warehouse: me.warehouse_details.name}}; + return { + filters: serial_no_filters + }; }, onchange: function(e) { if(this.in_local_change) return;