diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index 4dd8205a70c..5ee98de3767 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -65,7 +65,13 @@ frappe.ui.form.on("BOM", { }); }, - onload_post_render(frm) { + validate: function(frm) { + if (frm.doc.fg_based_operating_cost && frm.doc.with_operations) { + frappe.throw({message: __("Please check either with operations or FG Based Operating Cost."), title: __("Mandatory")}); + } + }, + + onload_post_render: function(frm) { frm.get_field("items").grid.set_multiple_add("item_code", "qty"); }, @@ -536,14 +542,20 @@ erpnext.bom.calculate_op_cost = function(doc) { doc.operating_cost = 0.0; doc.base_operating_cost = 0.0; - for(var i=0;i