diff --git a/src/backend/InvenTree/InvenTree/api_version.py b/src/backend/InvenTree/InvenTree/api_version.py index be70550481..db586544e4 100644 --- a/src/backend/InvenTree/InvenTree/api_version.py +++ b/src/backend/InvenTree/InvenTree/api_version.py @@ -1,13 +1,16 @@ """InvenTree API version information.""" # InvenTree API version -INVENTREE_API_VERSION = 272 +INVENTREE_API_VERSION = 273 """Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" INVENTREE_API_TEXT = """ +v273 - 2024-10-28 : https://github.com/inventree/InvenTree/pull/8376 + - Fixes for the BuildLine API endpoint + v272 - 2024-10-25 : https://github.com/inventree/InvenTree/pull/8343 - Adjustments to BuildLine API serializers diff --git a/src/backend/InvenTree/build/serializers.py b/src/backend/InvenTree/build/serializers.py index 583b620f5b..c7f8de1835 100644 --- a/src/backend/InvenTree/build/serializers.py +++ b/src/backend/InvenTree/build/serializers.py @@ -1307,6 +1307,9 @@ class BuildLineSerializer(DataImportExportSerializerMixin, InvenTreeModelSeriali 'available_variant_stock', 'external_stock', + # Related fields + 'allocations', + # Extra fields only for data export 'part_description', 'part_category_name', @@ -1330,6 +1333,8 @@ class BuildLineSerializer(DataImportExportSerializerMixin, InvenTreeModelSeriali part_category_id = serializers.PrimaryKeyRelatedField(source='bom_item.sub_part.category', label=_('Part Category ID'), read_only=True) part_category_name = serializers.CharField(source='bom_item.sub_part.category.name', label=_('Part Category Name'), read_only=True) + allocations = BuildItemSerializer(many=True, read_only=True) + # BOM item info fields reference = serializers.CharField(source='bom_item.reference', label=_('Reference'), read_only=True) consumable = serializers.BooleanField(source='bom_item.consumable', label=_('Consumable'), read_only=True) @@ -1403,6 +1408,9 @@ class BuildLineSerializer(DataImportExportSerializerMixin, InvenTreeModelSeriali # Pre-fetch related fields queryset = queryset.prefetch_related( 'allocations', + 'allocations__stock_item', + 'allocations__stock_item__part', + 'allocations__stock_item__location', 'bom_item__sub_part__stock_items', 'bom_item__sub_part__stock_items__allocations', diff --git a/src/frontend/src/tables/build/BuildOutputTable.tsx b/src/frontend/src/tables/build/BuildOutputTable.tsx index fbea651f5d..a377b0a741 100644 --- a/src/frontend/src/tables/build/BuildOutputTable.tsx +++ b/src/frontend/src/tables/build/BuildOutputTable.tsx @@ -153,7 +153,7 @@ export default function BuildOutputTable({ // Find all allocations which match the build output let allocations = item.allocations.filter( - (allocation: any) => (allocation.install_into = record.pk) + (allocation: any) => allocation.install_into == record.pk ); allocations.forEach((allocation: any) => {