Item Name updated when item code is selected

Hi , i wonder how i can do like sales order , when im selected item_code in my new doctype , the item_name is fetched

Thanks

Use custom script cur_frm.add_fetch to fetch value from master

   cur_frm.add_fetch('item_Code','item_name','item_name')

https://manual.erpnext.com/contents/customize-erpnext/custom-scripts/custom-script-examples/custom-script-fetch-values-from-master

1 Like

If what i want is to add item name and description? is there any short way?..or i should create it twice?

Where you want item name?
If you want in form then create custom field
If you want in print format use this,

frappe.db.get_value('Item', doc.item_code, 'item_name')

i mean is… if i want when the item is selected than the item name and description is updated, what should i do?

create custom script, no shortcut to add all field.

cur_frm.add_fetch(‘item_Code’,‘item_name’,‘item_name’)
cur_frm.add_fetch(‘item_Code’,‘item_description’,‘item_description’)

1 Like

thaaanks… that was great information

1 Like