Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Fix issue with build order lines table #8376

Merged
merged 4 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/backend/InvenTree/InvenTree/api_version.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
8 changes: 8 additions & 0 deletions src/backend/InvenTree/build/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,9 @@ class Meta:
'available_variant_stock',
'external_stock',

# Related fields
'allocations',

# Extra fields only for data export
'part_description',
'part_category_name',
Expand All @@ -1330,6 +1333,8 @@ class Meta:
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)
Expand Down Expand Up @@ -1403,6 +1408,9 @@ def annotate_queryset(queryset, build=None):
# 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',
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/tables/build/BuildOutputTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
Loading