Merge pull request #4868 from nabinhait/bom_fix
[fix] validate BOMs in BOM Replace Tool
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 302513f..d4d5329 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 @@
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