allocatedItems function now takes variants into account

This commit is contained in:
Oliver Walters 2021-06-01 16:19:24 +10:00
parent 9baf856d75
commit ee9df039cb

View File

@ -881,9 +881,12 @@ class Build(MPTTModel):
output - Build output (StockItem).
"""
# Remember, if 'variant' stock is allowed to be allocated, it becomes more complicated!
variants = part.get_descendants(include_self=True)
allocations = BuildItem.objects.filter(
build=self,
stock_item__part=part,
stock_item__part__pk__in=[p.pk for p in variants],
install_into=output,
)