Warehouse inquiry


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);

This is the new doctype.

My script is not working.