diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index 06b329e169e..e83f7e232ad 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -75,6 +75,9 @@ frappe.ui.form.on("BOM", { with_operations: function (frm) { frm.set_df_property("fg_based_operating_cost", "hidden", frm.doc.with_operations ? 1 : 0); + if (frm.doc.routing && frm.doc.with_operations && !frm.doc.operations.length) { + frm.trigger("routing"); + } }, fg_based_operating_cost: function (frm) { @@ -438,7 +441,7 @@ frappe.ui.form.on("BOM", { }, routing(frm) { - if (frm.doc.routing && frm.doc.with_operations && !frm.doc.operations) { + if (frm.doc.routing && frm.doc.with_operations && !frm.doc.operations.length) { frappe.call({ doc: frm.doc, method: "get_routing",