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
I have unhidden it and unticked print hide in Customize form
Item Supplier record matches Purchase Order supplier and item code
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?
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})