diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js index 3d2d5417604..92080c05baf 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.js +++ b/erpnext/manufacturing/doctype/work_order/work_order.js @@ -325,13 +325,18 @@ frappe.ui.form.on("Work Order", { 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({ method: "erpnext.manufacturing.doctype.work_order.work_order.make_job_card", freeze: true, args: { work_order: frm.doc.name, - operations: data.operations, + operations: selected_rows, }, callback: function () { frm.reload_doc(); @@ -342,7 +347,7 @@ frappe.ui.form.on("Work Order", { __("Create") ); - dialog.fields_dict["operations"].grid.wrapper.find(".grid-add-row").hide(); + dialog.fields_dict["operations"].grid.grid_buttons.hide(); var pending_qty = 0; frm.doc.operations.forEach((data) => {