fix: prevent disabled items from being used in bom (#58997)

Co-authored-by: Ajish18 <ajishiyappan1@gmail.com>
(cherry picked from commit e6f431a8d6)
This commit is contained in:
pandiyan
2026-09-11 17:50:30 +05:30
parent 8672a6e604
commit f1a7fd006d

View File

@@ -842,6 +842,19 @@ class BOM(WebsiteGenerator):
) )
) )
bom_items = {self.item, *items}
bom_items.update(d.item_code for d in self.get("secondary_items"))
bom_items.update(d.finished_good for d in self.get("operations") if d.finished_good)
if disabled_items := frappe.db.get_all(
"Item", filters={"item_code": ("in", list(bom_items)), "disabled": 1}, pluck="name"
):
frappe.throw(
_("Disabled Item {0} cannot be used in BOMs.").format(
", ".join(get_link_to_form("Item", item) for item in disabled_items)
)
)
def check_recursion(self, bom_list=None): def check_recursion(self, bom_list=None):
"""Check whether recursion occurs in any bom""" """Check whether recursion occurs in any bom"""