Updating child table values from other table values. Not working

I have added the following custom script in oppurtunity doctype and am expecting to see total_buy_price_dollar automatically getting updated when i change usd_unit_price. It does not work and am not sure exactly what i am doing wrong here. Please see my code below.

frappe.ui.form.on(“Oppurtunity Item”, {
usd_unit_price: function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
var total = 0;
frappe.model.set_value(d.doctype, d.name, “total_buy_price_dollar”, d.usd_unit_price * d.qty);
}
});

what doctype did you select in custom script “Opportunity” or “Opportunity Item”

frappe.ui.form.on("Opportunity Item", {
usd_unit_price: function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
var total = 0;
frappe.model.set_value(d.doctype, d.name,"total_buy_price_dollar", d.usd_unit_price * d.qty);
}
});

hi Mahesh,

Have selected “Oppurtunity” as doctype.

try above script which i replied

:blush: spelling mistake …thanks for pointing out.