refactor: serial no normalization

This commit is contained in:
Rohit Waghchaure
2022-10-10 13:28:19 +05:30
parent f11d9b019d
commit bc75a7ef44
23 changed files with 980 additions and 133 deletions

View File

@@ -341,10 +341,36 @@ erpnext.buying.BuyingController = class BuyingController extends erpnext.Transac
}
frappe.throw(msg);
}
});
}
}
);
}
}
update_serial_batch_bundle(doc, cdt, cdn) {
let item = locals[cdt][cdn];
let me = this;
let path = "assets/erpnext/js/utils/serial_no_batch_selector.js";
frappe.db.get_value("Item", item.item_code, ["has_batch_no", "has_serial_no"])
.then((r) => {
if (r.message && (r.message.has_batch_no || r.message.has_serial_no)) {
item.has_serial_no = r.message.has_serial_no;
item.has_batch_no = r.message.has_batch_no;
frappe.require(path, function() {
new erpnext.SerialNoBatchBundleUpdate(
me.frm, item, (r) => {
if (r) {
me.frm.refresh_fields();
frappe.model.set_value(cdt, cdn,
"serial_and_batch_bundle", r.name);
}
}
);
});
}
});
}
};
cur_frm.add_fetch('project', 'cost_center', 'cost_center');