mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-14 09:23:09 +00:00
fix: prevent disabled items from being used in BOM (#58997)
Co-authored-by: Ajish18 <ajishiyappan1@gmail.com>
This commit is contained in:
@@ -902,6 +902,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):
|
||||
"""Check whether recursion occurs in any bom"""
|
||||
bom_list = self.traverse_tree()
|
||||
|
||||
Reference in New Issue
Block a user