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",