Need to copy child table value into parent table


I need to copy item_code which is in child table to Parent table. I tried to get value and set it but its not working,

frappe.ui.form.on(‘Quotation’, {
item_code: function(frm) {
var item = frappe.model.get_value(“Quotation Item”,,“item_code”);

Thanks in advance!

Please explain in details on which parent table you want to copy item_code ?

Parent table is Quotation and child table is Quotation item

But we can have multiple items in child table, how can you store those in single field on Quotation.
Can you please tell me the exact use case.

We are giving only one item as default, my query is can we copy child table field in parent table. I have custom fields like vehicle model,vehicle colour in item…i need to fetch that values in quotation…but since the item code is in child table frm.add_fetch is not working, so i gave that item code field in parent…but i need the value to be copied from child table item code.