Autocomplete field

Hi, can you explain to me how does autocomplete works, like when i choose a customer when doing a quotation, the labels as price list, currency are autocompletion them selves, i wanted to make another label thats do autocomplete by choose the customer, but i dont know how does it work

@Dany_Carvalheiro, this are based in 2 features

add_fetch and set_df_property

  • add_fetch, works like the VLOOKUP of excel, to fetch a value from a referenced record
  • set_df_property change certain properties of a field, in this case (label)

These actions are made in JavaScript

1 Like

Steps:-

1.For that Go to “Customize Form”
Enter Form Type=Item Price
Add new Row-
Label= Item Group
Type=Data
check option “Read Only”->Done
Drag that Row under “Item Name” row ,if you want…
click on “Update” button

2.After that Go to “Custom Script” form (search for "Custom Script)
Create ‘New’
select Doc Type=Item Price

Write Script:-

frappe.ui.form.on(“Item Price”, “onload”, function(frm) {
cur_frm.add_fetch(‘item_code’, ‘item_group’, ‘item_group’);
})

Save Form.

You can refer following link also to read more things about custom script

http://frappe.github.io/erpnext/user/manual/en/customize-erpnext/custom-scripts/custom-script-examples/

thank you