Value of field based on previous Link field

Hi,
I made a child table and (just like quotation table) how can I fetch Item name, Brand, Rate from Item master based on inputed Item code (Linked to Item).

This is the table

This are the fields

This code isnt working

frappe.ui.form.on(‘Quotation Hardware’, {
refresh(frm) {
cur_frm.add_fetch(‘item_hardware’,‘item_name’,‘brand_hardware’,‘rate_hardware’);
cur_frm.add_fetch(‘item_hardware’,‘item_name’,‘brand_hardware’,‘rate_hardware’);
}
});

In the doctype fields table, each field has a default value option,
for the brand field in default enter item_hardware.brand
for the item name field enter item_hardware.item_name

In ERPNext Item price is not saved in the Item Master, it is saved in the item price list. You can have multiple prices for the same item in different price list.
For that you’ll have to call the item price list with the item code and price list, and set it to the rate.

1 Like

Thank you for your response

frappe.ui.form.on(‘Quotation Hardware’, {
refresh(frm) {
cur_frm.add_fetch(‘item_hardware’,‘item_hardware.item_name’,‘item_hardware.brand_hardware’,‘item_hardware.rate_hardware’);
cur_frm.add_fetch(‘item_hardware’,‘item_hardware.item_name’,‘item_hardware.brand_hardware’,‘item_hardware.rate_hardware’);

}
});
How do i fetch from price list?

How do I get this?

Go through erpnext/selling/selling_common.js and see how they’ve done it and try to replicate it.

Also go through erpnext/stock/get_item_details.py
There are many whitelisted methods you can call to get various item details.