Set_query problem!

Hello All,
I have a custom docType (Installment Plan) with a child table (Sales Invoice Items). The logic is very simple where in the “Installment Plan” document a user selects a “Customer” using a link field to the Customer docType and based on the value of this field a filter is applied to the child table (Sales invoice Items) where only this customers Sales invoices are allowed to be selected. Using frm.set_query() I was able to achieve it successufly but this only works once when the form is loaded. Trying to change the filter in the child table when a different cutomer is selected the initial filter stays there and any subsequent calls to frm.set_query() does NOTHING.

frappe.ui.form.on('Installment Plan', {
    "onload": (frm) => {
        child_table_set_query(frm,"sales_invoice_id","sales_invoice_items",{"customer": "0"});
    },
    "customer": (frm) => {
        if (frm.doc.customer) {
            child_table_set_query(frm,"sales_invoice_id","sales_invoice_items",{"customer": frm.doc.customer});
        }
    }
});

function child_table_set_query(frm,child_table_field,child_table_name,filters) {
    frm.set_query(child_table_field, child_table_name, () =>{
        return {
            "filters":filters
        };
    });
}```

Any help is greatly appreciated!
Dave

Please check this.

References:

While at it, refreshing the child table did the trick

frm.refresh_field("sales_invoice_items")