From 4464a591ef39d03d4441ee60fcbf36217f90e32f Mon Sep 17 00:00:00 2001 From: Rohan Date: Thu, 19 Mar 2020 18:02:35 +0530 Subject: [PATCH] fix: allow BOM to use same item as raw material --- erpnext/manufacturing/doctype/bom/bom.js | 3 +-- erpnext/manufacturing/doctype/bom/bom.py | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index 3acaee4ffb..70c4c608e7 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -43,8 +43,7 @@ frappe.ui.form.on("BOM", { frm.set_query("item_code", "items", function() { return { - query: "erpnext.controllers.queries.item_query", - filters: [["Item", "name", "!=", cur_frm.doc.item]] + query: "erpnext.controllers.queries.item_query" }; }); diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index f6cdb2e57c..b3e602bdfa 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -114,10 +114,6 @@ class BOM(WebsiteGenerator): child = self.append('operations', d) child.hour_rate = flt(d.hour_rate / self.conversion_rate, 2) - def validate_rm_item(self, item): - if (item[0]['name'] in [it.item_code for it in self.items]) and item[0]['name'] == self.item: - frappe.throw(_("BOM #{0}: Raw material cannot be same as main Item").format(self.name)) - def set_bom_material_details(self): for item in self.get("items"): self.validate_bom_currecny(item) @@ -147,7 +143,6 @@ class BOM(WebsiteGenerator): args = json.loads(args) item = self.get_item_det(args['item_code']) - self.validate_rm_item(item) args['bom_no'] = args['bom_no'] or item and cstr(item[0]['default_bom']) or '' args['transfer_for_manufacture'] = (cstr(args.get('include_item_in_manufacturing', '')) or