fix: Fiter passing fix in get batch query (#18131)

diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index ccd334f..d74bc0e 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -296,7 +296,6 @@
 				order by batch.expiry_date, sle.batch_no desc
 				limit %(start)s, %(page_len)s""".format(cond, match_conditions=get_match_cond(doctype)), args)
 
-	if batch_nos:
 		return batch_nos
 	else:
 		return frappe.db.sql("""select name, concat('MFG-', manufacturing_date), concat('EXP-',expiry_date) from `tabBatch` batch
diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js
index 045a046..41a59d0 100644
--- a/erpnext/public/js/utils/serial_no_batch_selector.js
+++ b/erpnext/public/js/utils/serial_no_batch_selector.js
@@ -271,14 +271,6 @@
 	get_batch_fields: function() {
 		var me = this;
 
-		let filters = {
-			item_code: me.item_code
-		}
-
-		if (me.warehouse || me.warehouse_details.name) {
-			filters['warehouse'] = me.warehouse || me.warehouse_details.name;
-		}
-
 		return [
 			{fieldtype:'Section Break', label: __('Batches')},
 			{fieldname: 'batches', fieldtype: 'Table', label: __('Batch Entries'),
@@ -292,7 +284,10 @@
 						'in_list_view': 1,
 						get_query: function () {
 							return {
-								filters: filters,
+								filters: {
+									item_code: me.item_code,
+									warehouse: me.warehouse || me.warehouse_details.name
+								},
 								query: 'erpnext.controllers.queries.get_batch_no'
 							};
 						},