You can add a filter via Javascript:
cur_frm.fields_dict.FIELD_NAME.get_query = function(doc,cdt,cdn) {
return {
filters:[
['ASOCIATED_DATA_FIELD_NAME', '=', "VALUES"]
]
}
}
You can replace the condition whit other that fit your case, for example “in” (in which case you should provide a list of values in “VALUES”), or “!=” or others.