To filter BOM based on item code selected in child table

I need to add BOM field to Opportunity Item doctype but it should filter by item chosen .

Can anyone help me with this ?

You can achive this with help of get query
cur_frm.fields_dict[‘bom’].get_query = function(doc, cdt, cdn) {
return {
filters: [
[‘Bom’,‘item’, ‘=’, frm.doc.item]
]
}
}