Limit Link field selection option based on Link field value

I have a Custom Field in Item DocType with a select field : Type A and Type B.

Now to my BOM DocType I want the user to able to select in Item Link field only from Type A
and Materials from Item Type B only …

You have to edit write custom code for this Currently item code comes in BOM based on https://github.com/frappe/erpnext/blob/develop/erpnext/manufacturing/doctype/bom/bom.js#L152

Yes I could do that but … no version control to that choice and that is why I have added Custom Field.

Is there any way to do this yet?

if I have doctype CustomDoc field type link to doctype "Supplier"

can I not limit selection results of Supplier where Supplier.somevalue = true ?