2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-11-13 11:26:42 +00:00

BOM updates (#10611) (#10612)

* BOM updates

- Allow variants of substititute parts to be allocated
- Closes https://github.com/inventree/InvenTree/issues/10606

* Check self.allow_variants

* Add comment

(cherry picked from commit a7c4f2adba)

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
github-actions[bot]
2025-10-18 12:06:16 +11:00
committed by GitHub
parent eb32546824
commit 486e338b0b

View File

@@ -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: