chore: allow to override serial batch selector

This commit is contained in:
Rohit Waghchaure
2024-03-27 11:52:06 +05:30
parent 079cc8bd21
commit 0d9d42ae61
8 changed files with 119 additions and 139 deletions

View File

@@ -430,25 +430,23 @@ $.extend(erpnext.utils, {
item_row.has_batch_no = r.message.has_batch_no;
item_row.has_serial_no = r.message.has_serial_no;
frappe.require("assets/erpnext/js/utils/serial_no_batch_selector.js", function () {
new erpnext.SerialBatchPackageSelector(frm, item_row, (r) => {
if (r) {
let update_values = {
serial_and_batch_bundle: r.name,
qty: Math.abs(r.total_qty),
};
new erpnext.SerialBatchPackageSelector(frm, item_row, (r) => {
if (r) {
let update_values = {
serial_and_batch_bundle: r.name,
qty: Math.abs(r.total_qty),
};
if (!warehouse_field) {
warehouse_field = "warehouse";
}
if (r.warehouse) {
update_values[warehouse_field] = r.warehouse;
}
frappe.model.set_value(item_row.doctype, item_row.name, update_values);
if (!warehouse_field) {
warehouse_field = "warehouse";
}
});
if (r.warehouse) {
update_values[warehouse_field] = r.warehouse;
}
frappe.model.set_value(item_row.doctype, item_row.name, update_values);
}
});
});
},