Supplier Part Number not working in Purchase Order Item

Supplier part number does not show in Purchase Order item or in Print format.
supplier_part_no is not being updated in tabPurchase Order Item (value is null)
Sql trace does not show the lookup query in tabItem Supplier

  1. I have unhidden it and unticked print hide in Customize form
  2. Item Supplier record matches Purchase Order supplier and item code
  3. Added Supplier Part Number column to Print Format and Purchase order item table

Please help me identify what is wrong. Where is the code that should fetch the supplier part no either when you add a purchase order item row, or when you save the purchase order?

I am using erpnext version 15 self hosted

1 Like

The problem seems to be the null value of supplier_part_no in tabPurchase Order Item. If I manually update the column to a non-null value, it then displays in the table and print format.

So the problem is why the supplier part number is not been looked up and the field populated when the PO is saved.

Could the problem be because I have added some custom fields to Item Supplier (manufacturer and manufacturer part number)? I tested the supplier part no on a fresh erpnext cloud site and it worked correctly.

I have found the problem. It was due to my customizations of the Item doctype form. I had substituted the default ā€œsupplier_itemsā€ table field with a different version called ā€œitem_suppliersā€ and the data was stored with that parent field. The lookup query for finding the supplier part number was expecting data with parent field ā€œsupplier_itemsā€: SELECT * FROM tabItem Supplier WHERE parent=ā€˜10081ā€™ AND parenttype=ā€˜Itemā€™ AND parentfield=ā€˜supplier_itemsā€™ ORDER BY idx ASC

To fix it, I have change a line in stock/get_item_details.py/party_item_code:
changed
item_supplier = item_doc.get(ā€œsupplier_itemsā€, {ā€œsupplierā€: args.supplier})
to
item_supplier = item_doc.get(ā€œitem_suppliersā€, {ā€œsupplierā€: args.supplier})