diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index b470f5bbfe..f6cdb2e57c 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -835,6 +835,10 @@ def add_operations_cost(stock_entry, work_order=None, expense_account=None): def get_bom_diff(bom1, bom2): from frappe.model import table_fields + if bom1 == bom2: + frappe.throw(_("BOM 1 {0} and BOM 2 {1} should not be same") + .format(frappe.bold(bom1), frappe.bold(bom2))) + doc1 = frappe.get_doc('BOM', bom1) doc2 = frappe.get_doc('BOM', bom2) diff --git a/erpnext/manufacturing/page/bom_comparison_tool/bom_comparison_tool.js b/erpnext/manufacturing/page/bom_comparison_tool/bom_comparison_tool.js index 7152d3dff6..1bcb1efdaa 100644 --- a/erpnext/manufacturing/page/bom_comparison_tool/bom_comparison_tool.js +++ b/erpnext/manufacturing/page/bom_comparison_tool/bom_comparison_tool.js @@ -22,7 +22,14 @@ erpnext.BOMComparisonTool = class BOMComparisonTool { fieldname: 'name1', fieldtype: 'Link', options: 'BOM', - change: () => this.fetch_and_render() + change: () => this.fetch_and_render(), + get_query: () => { + return { + filters: { + "name": ["not in", [this.form.get_value("name2") || ""]] + } + } + } }, { fieldtype: 'Column Break' @@ -32,7 +39,14 @@ erpnext.BOMComparisonTool = class BOMComparisonTool { fieldname: 'name2', fieldtype: 'Link', options: 'BOM', - change: () => this.fetch_and_render() + change: () => this.fetch_and_render(), + get_query: () => { + return { + filters: { + "name": ["not in", [this.form.get_value("name1") || ""]] + } + } + } }, { fieldtype: 'Section Break'