The first part of this question has been answered before. Adding a row to a child table:
var d = frappe.model.add_child(cur_frm.doc, "Quotation Item", "items");
Normally I would set the value of the row’s fields using:
d.item_code = x;
d.qty = y;
refresh_field("items");
In this case, I require setting item_code and triggering the script that runs when item_code is set. I assumed I should use frappe.model.set_value but I’m not sure of the right way. I’ve seen examples like this in the code but no luck. Any help is appreciated.
frappe.model.set_value(row.doctype, row.name, "field_name", x);