From b559245f2af52eb4fdf7cccf4ba77934fe9ad687 Mon Sep 17 00:00:00 2001 From: Vishal Date: Thu, 15 Dec 2022 11:17:14 +0530 Subject: [PATCH] feat: Add operating cost based on bom quanity without creating job card --- erpnext/manufacturing/doctype/bom/bom.js | 28 +++++++++++++++------- erpnext/manufacturing/doctype/bom/bom.json | 24 ++++++++++++++++++- erpnext/manufacturing/doctype/bom/bom.py | 26 ++++++++++++-------- 3 files changed, 59 insertions(+), 19 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index 4dd8205a70..5ee98de376 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