Custom Script Field Filtering

I added this as custom script to the stock entry doctype hoping the default warehouse will get filtered based on city. But there is no result. Any idea?

cur_frm.set_query("from_warehouse", function () {
    return{
        filters: { 'city': 'Dubai' }
    }
});

You could try this:

cur_frm.fields_dict["items"].grid.get_field("from_warehouse").get_query = function(doc){
       return {
               filters:{
                       "city": "Dubai"
               }
       }
}

Relevant Discussion:

2 Likes

I couldnt get any working! is there an overlapping code or something? I tried adding a test field linked with warehouse, didnt work. I tried the same code in another Doctype (supplier quotation) and it worked there ! :frowning:

Ok. There was a code from stock_controller.js that was conflicting my efforts. Thank you!