Merge pull request #48777 from frappe/mergify/bp/version-15-hotfix/pr-48773

fix: create job card for selected operations only (backport #48773)
This commit is contained in:
Mihir Kandoi
2025-07-29 13:00:28 +05:30
committed by GitHub

View File

@@ -325,13 +325,18 @@ frappe.ui.form.on("Work Order", {
return operations_data; return operations_data;
}, },
}, },
function (data) { function () {
const selected_rows = dialog.fields_dict["operations"].grid.get_selected_children();
if (selected_rows.length == 0) {
frappe.msgprint(__("Please select atleast one operation to create Job Card"));
return;
}
frappe.call({ frappe.call({
method: "erpnext.manufacturing.doctype.work_order.work_order.make_job_card", method: "erpnext.manufacturing.doctype.work_order.work_order.make_job_card",
freeze: true, freeze: true,
args: { args: {
work_order: frm.doc.name, work_order: frm.doc.name,
operations: data.operations, operations: selected_rows,
}, },
callback: function () { callback: function () {
frm.reload_doc(); frm.reload_doc();
@@ -342,7 +347,7 @@ frappe.ui.form.on("Work Order", {
__("Create") __("Create")
); );
dialog.fields_dict["operations"].grid.wrapper.find(".grid-add-row").hide(); dialog.fields_dict["operations"].grid.grid_buttons.hide();
var pending_qty = 0; var pending_qty = 0;
frm.doc.operations.forEach((data) => { frm.doc.operations.forEach((data) => {