From c8c67f7807c9c50940357ab4f2641b9ffea133d5 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Thu, 15 Jan 2015 13:11:27 +0530 Subject: [PATCH 1/2] Bom operations and item link removed. Cost recalculated on removal of operation or rew material row. --- erpnext/manufacturing/doctype/bom/bom.js | 37 +++++-------------- erpnext/manufacturing/doctype/bom/bom.py | 13 +++---- .../doctype/bom_item/bom_item.json | 14 +------ 3 files changed, 18 insertions(+), 46 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index 7dedface67..a5d500f87c 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -13,9 +13,6 @@ cur_frm.cscript.refresh = function(doc,dt,dn){ cur_frm.add_custom_button(__("Update Item Description"), cur_frm.cscript.update_item_desc, "icon-tag", "btn-default"); } - - cur_frm.cscript.with_operations(doc); - erpnext.bom.set_operation(doc); } cur_frm.cscript.update_cost = function() { @@ -37,29 +34,6 @@ cur_frm.cscript.update_item_desc = function() { } }) } - -cur_frm.cscript.with_operations = function(doc) { - cur_frm.fields_dict["items"].grid.set_column_disp("operation", doc.with_operations); - cur_frm.fields_dict["items"].grid.toggle_reqd("operation", doc.with_operations); -} - -erpnext.bom.set_operation = function(doc) { - var op_table = doc["operations"] || []; - var operations = []; - - for (var i=0, j=op_table.length; i Date: Mon, 19 Jan 2015 18:20:44 +0530 Subject: [PATCH 2/2] fixes --- erpnext/manufacturing/doctype/bom/bom.py | 16 ++++------------ .../manufacturing/doctype/bom/test_records.json | 3 --- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index cfd93308eb..f77628a417 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -214,22 +214,14 @@ class BOM(Document): frappe.throw(_("Raw Materials cannot be blank.")) check_list = [] for m in self.get('items'): - if m.bom_no: validate_bom_no(m.item_code, m.bom_no) - if flt(m.qty) <= 0: frappe.throw(_("Quantity required for Item {0} in row {1}").format(m.item_code, m.idx)) - - self.check_if_item_repeated(m.item_code, check_list) - - - def check_if_item_repeated(self, item, check_list): - - if [cstr(item)] in check_list: - frappe.throw(_("Item {0} has been entered multiple times.").format(item)) - else: - check_list.append([cstr(item)]) + check_list.append(cstr(m.item_code)) + unique_chk_list = set(check_list) + if len(unique_chk_list) != len(check_list): + frappe.throw(_("Same item has been entered multiple times.")) def check_recursion(self): """ Check whether recursion occurs in any bom""" diff --git a/erpnext/manufacturing/doctype/bom/test_records.json b/erpnext/manufacturing/doctype/bom/test_records.json index c37cef07e1..6f10b21e1c 100644 --- a/erpnext/manufacturing/doctype/bom/test_records.json +++ b/erpnext/manufacturing/doctype/bom/test_records.json @@ -67,7 +67,6 @@ ], "items": [ { - "operation": 1, "amount": 5000.0, "doctype": "BOM Item", "item_code": "_Test Item", @@ -77,7 +76,6 @@ "stock_uom": "_Test UOM" }, { - "operation": 1, "amount": 2000.0, "bom_no": "BOM/_Test Item Home Desktop Manufactured/001", "doctype": "BOM Item", @@ -108,7 +106,6 @@ ], "items": [ { - "operation": 1, "amount": 5000.0, "doctype": "BOM Item", "item_code": "_Test Item",