From baa6d96a829e351f36436482c104d08ea367e25a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 24 Feb 2016 18:51:13 +0530 Subject: [PATCH] [fix] validate BOMs in BOM Replace Tool --- .../doctype/bom_replace_tool/bom_replace_tool.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py b/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py index 302513f1fb1..d4d5329acea 100644 --- a/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py +++ b/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py @@ -23,6 +23,10 @@ class BOMReplaceTool(Document): def validate_bom(self): if cstr(self.current_bom) == cstr(self.new_bom): frappe.throw(_("Current BOM and New BOM can not be same")) + + if frappe.db.get_value("BOM", self.current_bom, "item") \ + != frappe.db.get_value("BOM", self.new_bom, "item"): + frappe.throw(_("The selected BOMs are not for the same item")) def update_new_bom(self): current_bom_unitcost = frappe.db.sql("""select total_cost/quantity