Retrieve information from items in a purchase order or purchase invoice

I have added some custom fields to Items, to record some customs information about each item such as custom tariff code, country of origin, a brief description of the part , etc. Right now I need to print this information for all the items listed in a purchase order, or a purchase invoice, to give it to my customs agent. Can you please give me a hint on how to do this?


I’m not sure but i’ll try help you, you can try create a doctype with this custom fields of the itens and in the purchase order you customize form and add this doctype and mark the checkbox “in list view”

Hi Thiago, thanks for your answer

I don’t want this information to appear in the purchase order. I want to be able to create a new document with this information from the items of a purchase order. I’m not sure I am clear. I mean if there is an easy way to add and remove this from the purchase order then it would be fine, because I would use the standard purchase order to be sent to my provider, and the modified one to the custom agent, but I don’t know if this is possible.

You can “Print Hide” fields in your doc type in case you don’t want them to appear on print

Two different ways of doing it…
1.You can store them in Purchase Order item and create a separate print format which will display the custom fields and you can use that to print when you are sending documents to customs guy… and you can continue to use standard print format when you sending the document to supplier as standrd print format will not display the custom fields…

2.Without storing custom fields details in PO : Create a custom print format in jinja and use frappe.db.get_value to fetch the custom fields details from item table and display in print format…

I’m storing the custom information information in the item (I customized the item form), but I’m not being able to show this information in the items table of the purchase order. I tried creating a custom field in the Purchase Order Item Table, with the same name as the custom fiel in item, but it does not work. I’m a bit lost. Should a create a custom script for the Purchase Order Item?

Create a custom script and use “add_fetch”

By doing this whenever you pick a item in PO, custom details are also stored in PO items.