From 81b8d7597d067e5bdbb2e799a36346d2b2ab4c78 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 3 Mar 2015 14:44:02 +0530 Subject: [PATCH] bom with operations activity --- erpnext/manufacturing/doctype/bom/bom.js | 15 +++++++++++++++ erpnext/manufacturing/doctype/bom/bom.json | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index d5825017d6..edfa4381f3 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -5,6 +5,7 @@ frappe.provide("erpnext.bom"); cur_frm.cscript.refresh = function(doc,dt,dn){ cur_frm.toggle_enable("item", doc.__islocal); + toggle_operations(cur_frm); if (!doc.__islocal && doc.docstatus<2) { cur_frm.add_custom_button(__("Update Cost"), cur_frm.cscript.update_cost, @@ -210,6 +211,20 @@ frappe.ui.form.on("BOM Item", "items_remove", function(frm) { erpnext.bom.calculate_total(frm.doc); }); +var toggle_operations = function(frm) { + frm.toggle_display("operations_section", cint(frm.doc.with_operations) == 1); +} + +frappe.ui.form.on("BOM", "with_operations", function(frm) { + if(!cint(frm.doc.with_operations)) { + frm.set_value("operations", []); + } + toggle_operations(frm); +}); + + cur_frm.cscript.image = function() { refresh_field("image_view"); } + + diff --git a/erpnext/manufacturing/doctype/bom/bom.json b/erpnext/manufacturing/doctype/bom/bom.json index 2f95e85f36..239df47d92 100644 --- a/erpnext/manufacturing/doctype/bom/bom.json +++ b/erpnext/manufacturing/doctype/bom/bom.json @@ -82,7 +82,7 @@ "permlevel": 0 }, { - "depends_on": "with_operations", + "depends_on": "", "description": "Specify the operations, operating cost and give a unique Operation no to your operations.", "fieldname": "operations_section", "fieldtype": "Section Break", @@ -279,7 +279,7 @@ "is_submittable": 1, "issingle": 0, "istable": 0, - "modified": "2015-02-21 10:31:18.889394", + "modified": "2015-03-03 14:22:44.725097", "modified_by": "Administrator", "module": "Manufacturing", "name": "BOM",