Merge pull request #40752 from rohitwaghchaure/provision-to-override-batch-dialog

chore: allow to override serial batch selector using custom app
This commit is contained in:
rohitwaghchaure
2024-03-29 09:10:36 +05:30
committed by GitHub
8 changed files with 119 additions and 139 deletions

View File

@@ -2509,27 +2509,25 @@ erpnext.show_serial_batch_selector = function (frm, item_row, callback, on_close
}
}
frappe.require("assets/erpnext/js/utils/serial_no_batch_selector.js", function() {
if (["Sales Invoice", "Delivery Note"].includes(frm.doc.doctype)) {
item_row.type_of_transaction = frm.doc.is_return ? "Inward" : "Outward";
} else {
item_row.type_of_transaction = frm.doc.is_return ? "Outward" : "Inward";
}
if (["Sales Invoice", "Delivery Note"].includes(frm.doc.doctype)) {
item_row.type_of_transaction = frm.doc.is_return ? "Inward" : "Outward";
} else {
item_row.type_of_transaction = frm.doc.is_return ? "Outward" : "Inward";
}
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 (r.warehouse) {
update_values[warehouse_field] = r.warehouse;
}
frappe.model.set_value(item_row.doctype, item_row.name, update_values);
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 (r.warehouse) {
update_values[warehouse_field] = r.warehouse;
}
frappe.model.set_value(item_row.doctype, item_row.name, update_values);
}
});
}