diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py index 095a8cf70c..01c2c781e9 100644 --- a/InvenTree/build/models.py +++ b/InvenTree/build/models.py @@ -383,9 +383,7 @@ class Build(MPTTModel, ReferenceIndexingMixin): Returns the BOM items for the part referenced by this BuildOrder """ - return self.part.bom_items.all().prefetch_related( - 'sub_part' - ) + return self.part.get_bom_items() @property def tracked_bom_items(self): diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 33ad8bf612..09e1f77542 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -1453,7 +1453,9 @@ class Part(MPTTModel): 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): """