From 8cd36f60ab8dda4b854b38e7701d89924ede902f Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Thu, 23 Jul 2026 12:52:27 +0530 Subject: [PATCH] fix: prompt for operation row when operation repeats in work order --- .../doctype/job_card/job_card.js | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/job_card/job_card.js b/erpnext/manufacturing/doctype/job_card/job_card.js index bea0bc914c6..9a0194618ed 100644 --- a/erpnext/manufacturing/doctype/job_card/job_card.js +++ b/erpnext/manufacturing/doctype/job_card/job_card.js @@ -504,8 +504,26 @@ frappe.ui.form.on("Job Card", { operation: frm.doc.operation, }, callback(r) { - if (r.message && r.message.length == 1) { + if (!r.message || !r.message.length) return; + + if (r.message.length == 1) { frm.set_value("operation_id", r.message[0].name); + } else { + frappe.prompt( + { + fieldname: "operation_row", + fieldtype: "Select", + label: __("Operation Row"), + options: r.message.map((row) => ({ label: row.idx, value: row.name })), + reqd: 1, + description: __( + "Operation {0} is added multiple times in the work order {1}", + [frm.doc.operation, frm.doc.work_order] + ), + }, + (values) => frm.set_value("operation_id", values.operation_row), + __("Select Operation Row") + ); } }, });