fix: allow BOM to use same item as raw material

This commit is contained in:
Rohan 2020-03-19 18:02:35 +05:30
parent ef491f92d2
commit 4464a591ef
2 changed files with 1 additions and 7 deletions

View File

@ -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"
};
});

View File

@ -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