Item custom field in Invoice

Hi there,
I was able to customize ErpNext Stock>Item and have added Item_Type and Item_Color fields. This is working well and now I have items with these details in ErpNext. But when I sell these items, I want these item details to also show up in the Invoice. The Item table does not show these custom fields.
Could someone tell me how the custom field data can be available else where in ErpNext?

Hello,

Print Hide field is checked for this custom fields. Check related customize form to confirm. It should be unchecked.

Regards,
Prakash

I have since my post updated the Sale Invoice Item to include the same custom field.
Now the field appears in the sales item table list, when I customize the invoice.
But the value in the custom field does not appear when the actual printed invoice is created.

The custom field I have created is a select field (for the Item) called item_type, with selections as Glossy, Matt, SemiGlossy etc

I dont know what this has to do with the Print Hide field.

Hello,

Checking ‘Print Hide’ will hide field from the Standard print format. Check below help page for more details.

https://frappe.github.io/erpnext/user/manual/en/customize-erpnext/customize-form

Regards,
Prakash

Exactly. But I want the field to show. So I have not checked the Print Hide option. Yet, the custom field does not show up on the invoice print.

I think my query has been asked before.

The knowledge base article on this link is missing.
https://frappe.io/kb/customization/fetch-custom-field-value-from-master-to-all-related-transactions

Some more search and I have the following step by step method:

To add a custom field in item & get the same custom field in invoice,

  1. Create the Custom Field “abc” under Doc Type Item
  2. Create the Custom Field “abc” under Doc Type “Sales Order Item”
  3. Create the Custom Script under doc type “Sales Order” (Note that it has to be created under “Sales Order”) cur_frm.add_fetch(‘item’, ‘abc’, ‘abc’)

And yet, it doesnt work!!

I tried various combinations after reading through similar postings and have been able to get it working. The following are my observations. Maybe we can add an entry into the manual on how to create a custom entry in one document that is used in other documents.

The manual
https://frappe.github.io/erpnext/user/manual/en/customize-erpnext/custom-scripts/custom-script-examples/custom-script-fetch-values-from-master.html
says
add_fetch(link_fieldname, source_fieldname, target_fieldname) -> cur_frm.add_fetch(‘item’, ‘abc’, ‘abc’)
but this doesnt work
Instead need this
cur_frm.add_fetch(“item_code”, “abc”, “abc”)

I have to further check if the single quote will work. Item doesnt work. Item_code works. Is this a code error?

I’m trying to do this with our items. I’m pretty new to this. Did you succeed in setting this up? Would you be able to share your process? Thanks!

Alternatively, if anyone is knowledgeable with this, please PM me. I’m willing to offer a little budget to have this setup properly as I don’t want to do something wrong if I’m to do it myself.

@Clinton_Wong - Create your custom field on the related doctypes as desired. Make sure the names are identical and are of the same data type. Thereafter the framework will work its magic and copy the data for you without any additional work. The key is in the naming of the custom fields and selection of the data types.

Just to emphasize, no custom scripts will be required

Hi Eli,

Thanks for the help. But I’m not really that confident in doing this as I’m
afraid I’ll screw up the system. Especially when it comes to setting up the
scripts for CBM calculations which I basically have no knowledge about. I
have succeeded in creating the custom fields. But from what I read on the
forums, doing the auto CBM calculations or if I wanted the system to
calculated the carton amount based on the unit amount of each order and the
carton measurements, additional scripts are required.

Best Regards
Clinton

Yes, custom scripts are required for the CBM calcs.

Refer to this detailed step by step guide provided here: Sell in weight reduce stock in units

You can’t go wrong after the superb write up that was done by this guy