Repack to Fill an Empty Batch


We are currently trying to repack an item that both has batch
Let’s assume:
Item A has batch A1 in Warehouse A with quantity 5
Item B has batch B1 in Warehouse B with empty quantity (quantity : 0)

When we try to repack
Item A with batch A1 in Warehouse A quantity would be minuses by 3 (for example)
Item B with batch B1 in Warehouse B suppose to be increased by 2 (for example)
But when we choose Warehouse B and item B… We can’t choose batch B1 as the batch we are trying to add, because the quantity of Batch B1 in Warehouse B is empty.

This is odd, since we are trying to increase the quantity of batch B using batch A

When we trace the code in stock_entry.js

frm.set_query('batch_no', 'items', function(doc, cdt, cdn) {
			var item = locals[cdt][cdn];
			if(!item.item_code) {
				frappe.throw(__("Please enter Item Code to get Batch Number"));
			} else {
				if (in_list(["Material Transfer for Manufacture", "Manufacture", "Repack", "Send to Subcontractor"], doc.purpose)) {
					var filters = {
						'item_code': item.item_code,
						'posting_date': frm.doc.posting_date || frappe.datetime.nowdate()
				} else {
					var filters = {
						'item_code': item.item_code

				filters["warehouse"] = item.s_warehouse || item.t_warehouse;

				return {
					query : "erpnext.controllers.queries.get_batch_no",
					filters: filters

We found out that there’s a filter parameter warehouse…
Which is odd, since we don’t need to be aware of warehouse in target warehouse in general.

Did we miss something? Like, maybe we should do this using another feature of ERPNext
Should target warehouse even be considered when we try to do stock entry? if yes, why?

Thanks beforehand for the guidance