From baf884f95c4ee18946cf9b63b9cd0b83af39a292 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 9 Dec 2025 15:38:46 +0530 Subject: [PATCH] fix: item should not be a fixed asset if bom is phantom --- erpnext/manufacturing/doctype/bom/bom.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index a474524d792..8e4081d5d63 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -41,13 +41,14 @@ frappe.ui.form.on("BOM", { }; }); + frm.phantom_bom_filters = { + query: "erpnext.manufacturing.doctype.bom.bom.item_query", + filters: { + is_stock_item: !frm.doc.is_phantom_bom, + }, + }; frm.set_query("item", function () { - return { - query: "erpnext.manufacturing.doctype.bom.bom.item_query", - filters: { - is_stock_item: !frm.doc.is_phantom_bom, - }, - }; + return frm.phantom_bom_filters; }); frm.set_query("project", function () { @@ -248,6 +249,12 @@ frappe.ui.form.on("BOM", { frappe.set_route("List", "Item", { variant_of: frm.doc.item }); }); } + + if (frm.doc.is_phantom_bom) { + frm.phantom_bom_filters.filters.is_fixed_asset = 0; + } else { + delete frm.phantom_bom_filters.filters.is_fixed_asset; + } }, make_work_order(frm) {