Question about frm.set_query for fields in child table


I have an issue on setup query for my child table in my form of my app.
First of all like in my snapshot below, my child table Items has field called Delivery Note ID which is linked to document Delivery Note. i had set_query code in my custom script, but there is no effect in editable mode
As you can see filters applied for Name in is nothing.
but if I click the edit button if this row, in detailed mode I can see the filters correct.

second, if I change the value of field Item Code, still in detailed mode, the filters still maintain the last status, won’t change accordingly (my custom script has code to change it if Item Code changed)
but if I return back to child table and click edit again, then the filters applied correct.

So I don’t know why and how to resolve it?


My erpnext version is 13.19.0, same as frappe version.

@ithelpdesk where exactly you are writing the js code ?


I’m using client script in erpnext.


You may refer following code snippet:

frappe.ui.form.on("Material Request", "onload", function(frm, cdt, cdn){

    cur_frm.fields_dict["items"].grid.get_field("warehouse").get_query = function(doc) {

        return {

            filters: {


                'is_group': 0




Hi @pioneerpathan

Thanks for the response, I tried with your code, there is no lucky, same result as my code.

Hello @ithelpdesk Can you send me a code snipet of yours ? I’m working on how to implement a child table in a parent table in script with the conditional statement.