mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-01 04:56:45 +00:00
[Bug] Fix issue with build order lines table (#8376)
* Revert change to BuildItem API - Requires "allocations" for build output table - Probably can refactor this later * Bug fix for BuildOutputTable in PUI - Correct calculation for "fully allocated" * Adjust annotations for serializer * Bump API version
This commit is contained in:
parent
21ab1a184d
commit
6953640161
@ -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
|
||||
|
||||
|
@ -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',
|
||||
|
@ -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) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user