Merge pull request #2697 from SchrodingersGat/allocation-bug

Bug fix for BuildOrder.bom_items
This commit is contained in:
Oliver 2022-03-02 00:32:35 +11:00 committed by GitHub
commit 35451be4f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -383,9 +383,7 @@ class Build(MPTTModel, ReferenceIndexingMixin):
Returns the BOM items for the part referenced by this BuildOrder Returns the BOM items for the part referenced by this BuildOrder
""" """
return self.part.bom_items.all().prefetch_related( return self.part.get_bom_items()
'sub_part'
)
@property @property
def tracked_bom_items(self): def tracked_bom_items(self):

View File

@ -1453,7 +1453,9 @@ class Part(MPTTModel):
By default, will include inherited BOM items By default, will include inherited BOM items
""" """
return BomItem.objects.filter(self.get_bom_item_filter(include_inherited=include_inherited)) queryset = BomItem.objects.filter(self.get_bom_item_filter(include_inherited=include_inherited))
return queryset.prefetch_related('sub_part')
def get_installed_part_options(self, include_inherited=True, include_variants=True): def get_installed_part_options(self, include_inherited=True, include_variants=True):
""" """