This filter needs to implemented in the Parent doc.
frappe.ui.form.on(<ParentDoctype>, {
onload: function(frm) {
frm.set_query('<child_tables_link_fieldname>', '<fieldname_of_childtable_in_parentdoc>', ()=>{
return{
filters:{
//condition here
}
}
})
}
})
Refer to the official documentation frm-set-query