Try ERPNext Buy Support Partners Foundation Foundation Members

Search field work in PO but not in Purchase Invoice

Before v12, I was using the field manufacturer_part_no to store the supplier/manufacturer part number and I made a custom script in the purchase order so I can search it when I type the code in the purchase order item table.
frappe.ui.form.on(“Purchase Order”, “refresh”, function (frm, cdt, cdn) {
cur_frm.set_query(“item_code”, “items”, function () {
return {
query: “erpnext.controllers.queries.item_query”,
searchfield: “manufacturer_part_no”,
filters: {‘is_purchase_item’: 1}
}
});
});

But with v12, this field disappeard. It’s not visible anymore in the item doctype. It’s listed under manufacturer but it’s empty.
BUT if I search for the old manufacturer number I put there in v11, it in the PO, we can still find the item (with my custom script).

So, I need to be able to get access to this hidden field that is unlisted but still available somehow.

And I’m also looking for a new way to search the supplier part number directly when I’m typing the item number in the purchase item table while creating a PO. I tried few things in the custom script but nothing is working I get error when I open the PO.