Fetch purchase item only in purchase request

Hi,
I need to fetch purchase items only in material request(typ = purchase) while getting items from bom.
now it is fetching all items from bom.
please let me know where to change code

Thanks

erpnext/manufacturing/doctype/bom/bom.py

you should add condition in sql query inside this function “get_bom_items_as_dict”.

Thanks