fix: allow BOM to use same item as raw material
This commit is contained in:
parent
ef491f92d2
commit
4464a591ef
@ -43,8 +43,7 @@ frappe.ui.form.on("BOM", {
|
|||||||
|
|
||||||
frm.set_query("item_code", "items", function() {
|
frm.set_query("item_code", "items", function() {
|
||||||
return {
|
return {
|
||||||
query: "erpnext.controllers.queries.item_query",
|
query: "erpnext.controllers.queries.item_query"
|
||||||
filters: [["Item", "name", "!=", cur_frm.doc.item]]
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -114,10 +114,6 @@ class BOM(WebsiteGenerator):
|
|||||||
child = self.append('operations', d)
|
child = self.append('operations', d)
|
||||||
child.hour_rate = flt(d.hour_rate / self.conversion_rate, 2)
|
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):
|
def set_bom_material_details(self):
|
||||||
for item in self.get("items"):
|
for item in self.get("items"):
|
||||||
self.validate_bom_currecny(item)
|
self.validate_bom_currecny(item)
|
||||||
@ -147,7 +143,6 @@ class BOM(WebsiteGenerator):
|
|||||||
args = json.loads(args)
|
args = json.loads(args)
|
||||||
|
|
||||||
item = self.get_item_det(args['item_code'])
|
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['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
|
args['transfer_for_manufacture'] = (cstr(args.get('include_item_in_manufacturing', '')) or
|
||||||
|
Loading…
Reference in New Issue
Block a user