How to Disable Standard Company Filter in Target Warehouse

I have a single instance multi-company setup. I want to be able to transfer goods from one warehouse to the other but the Target Warehouse has a standard company filter:


How can i remove this filter so i can directly transfer goods from one company warehouse to another?

Maybe overwriting the get_query of the field in js:

cur_frm.fields_dict.FIELD_NAME.get_query = function(doc,cdt,cdn) {
	return {
		filters:[
			['FIELD', '=', 'VALUE']
		]
	}
}

I can’t seem to find this field in the js. I’ve checked several times.

The field is named to_warehouse
You should do something like this:

cur_frm.fields_dict.to_warehouse.get_query = function(doc,cdt,cdn) {
	return {
		filters:[
			['company', '=', doc.company]
		]
	}
}

But i’m not sure if there isn’t a server side validation of the warehouse company.

@Nahuel_Nso i’m assuming this is in material_request.js? I have searched i can’t find it… or is this a custom script?

You are talking about Stock Entry, you should add this code in your stock_entry.js in your app. Or try it in console (open a new stock entry form and paste that code in the browser console). If you want to change the code of the core, you should look for something similar to that in the stock_entry.js of ERPNext and change it. You can add this as custom script too.

This is the error from custom script:
image
I’ve checked stock_entry.js but there’s no filter command in there.

I think that you are missing one more } before the )

@Nahuel_Nso Fixed that but error still persists:

UPDATE: So i fixed the issue with record does not exist and the custom script saved successfully but the filter in the Default Target Warehouse is still there.

If reloading the page and clearing the cache does not help, then I don’t know what’s happening. Maybe the filter is there in another way, maybe it wasn’t setted with the get_query method.