Custom field from Item in supplier price list

I have a custom data field in the Item document which I need to get added to the price list list report.

This field is used as a unique key for a report we run and then export to CSV.

How is it possible for the item price list report to show the custom data field so that we can export it then to CSV?

I added the field to the item price form and made the type from the drop-down menu “Read Only”.

If the field is called “EAN” for example then under options I also added “item.EAN”

Lastly I made a custom script for doct type “item price” as follows:

cur_frm.add_fetch(‘item’,‘ean’,‘ean’);

This all does not seem to populate the EAN field int he price list report. Any help?

add_fetch only works for new records.

You can either query-update your Item Price table or make a query report using join

https://frappe.io/kb/reports/how-to-make-query-report

how would I query-update the Item Price table?

BTW I did not realize this, but this is for a new record and its not working. How can I show you?

Do you have any exception in your JS console?

You can update using JS query

update `tabItem Price` set ..

I am not sure. How can I tell? How do I run that command? Can you give me an example based on the field being called EAN?

You have to run that query in the mysql console bench frappe --mysql

Read up a bit on MySQL and SQL before doing anything dangerous!

I’ve almost confirmed this is a bug. The record is new and it does not update or populate. Running a query each time seems like it’s not the ideal solution.

can someone help me troubleshoot this to figure out if its a bug or if I am doing something wrong?

I put in a new issue in github: Custom field not updating and populating in reports · Issue #2885 · frappe/erpnext · GitHub

It seems the script is not requesting the value of the new field. It requests the item code, name and description but not the new custom field.

Replied on GitHub…

I am the one working on this project too. I have created the custom field in Item, the custom field in Item Price, and the script in Item Price. When adding a new item price entry it is pulling in the Item Description but not the custom field.

Is there any way to see the scripts that are defied for the standard fields? In this case the custom field should be exactly like the Item Name and Item Description in Item Price in that it pulls those two fields from the values from the Item document.

@ahj can’t really guess what is going wrong with your system unless we explain what you have done - include screenshots, code snippets etc.

I think he is experiencing the same thing I was according to the link above: Custom field not updating and populating in reports · Issue #2885 · frappe/erpnext · GitHub

I don’t understand why having a custom field does not populate reports?

AFAIK, add_fetch works fine for new records, not sure what your issue is.

I posted the steps I performed to receive the current result in the github link above. Have you tried it recently?

I add a custom field to item (type: data), add a new field to item price (type: data), and then create the script for Item Price:

cur_frm.add_fetch(‘item’,‘asin’,‘asin’)

When I go under Selling > Items I see the asin field is populated (If not, I add it, then I click save), then I click Add/Edit Prices > New and I can see Item Name, and Item Description get filled in but asin is blank. If I save proceed to save Item Price the asin custom field remains empty.

Sorry, I can’t post a screenshot because it says my account is too new.