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:
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.
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.