Warehouse inquiry

Hello,

Need help.

I added additional field in Sales Invoice, WAREHOUSE. The function is if I select a “warehouse type” all items in sales invoice item will be tag to the selected warehouse.

This is the script I put in the custom script

frappe.ui.form.on(“Sales Invoice Item”, “warehouse”, function (frm, cdt,cdn) {
var d = locals[cdt][cdn];
if (cur_frm.doc.warehouse_type) {
frappe.model.set_value(cdt, cdn, “warehouse_code”, cur_frm.doc.warehouse);
cur_frm.refresh_field(‘items’);
}
});

This is the new doctype.

My script is not working.