How can I return parent doctype based on value of its child table in script report filter get_query?

I want to return warehouses in the warehouse filter which is under a particular branch but the branch field in a warehouse is under a child table “warehouse branch”. How can i use get_query in the js to return the warehouse based on the child table?

Parent Doctype is Warehouse and child Doctype is Warehouse Branch.

{
“fieldname”: “warehouse”,
“label”: __(“Warehouse”),
“fieldtype”: “Link”,
“width”: “80”,
“options”: “Warehouse”,
“get_query”: function(){
var branch = frappe.query_report.filters_by_name.cost_center.get_value();
// frappe.msgprint(branch)
return {“doctype”:“Warehouse Branch”, “filters”:{“branch”:branch}}
}
}

I want to return its parent doctype that is Warehouse not Warehouse Branch?

Solved

Can you share your code as to how you solved it? Thanks

can you share how you solve the problem?