From a7c4f2adba512ec7275e317d6de761c7f152c4d5 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sat, 18 Oct 2025 11:49:46 +1100 Subject: [PATCH] BOM updates (#10611) * BOM updates - Allow variants of substititute parts to be allocated - Closes https://github.com/inventree/InvenTree/issues/10606 * Check self.allow_variants * Add comment --- src/backend/InvenTree/part/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backend/InvenTree/part/models.py b/src/backend/InvenTree/part/models.py index 64ce7eedd0..ab6d5e7944 100644 --- a/src/backend/InvenTree/part/models.py +++ b/src/backend/InvenTree/part/models.py @@ -4271,6 +4271,11 @@ class BomItem(InvenTree.models.MetadataMixin, InvenTree.models.InvenTreeModel): for sub in self.substitutes.all(): parts.add(sub.part) + # Account for variants of the substitute part (if allowed) + if allow_variants and self.allow_variants: + for sub_variant in sub.part.get_descendants(include_self=False): + parts.add(sub_variant) + valid_parts = [] for p in parts: