2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-09-14 14:41:33 +00:00

Build on order (#10111)

* add DecimalColumn component

* Adds more production information to build lines

* Bump API version

* Improve rendering
This commit is contained in:
Oliver
2025-08-01 15:34:39 +10:00
committed by GitHub
parent e494aef1ff
commit bc382cd883
8 changed files with 75 additions and 33 deletions

View File

@@ -1,12 +1,15 @@
"""InvenTree API version information."""
# InvenTree API version
INVENTREE_API_VERSION = 377
INVENTREE_API_VERSION = 378
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
INVENTREE_API_TEXT = """
v378 -> 2025-08-01 : https://github.com/inventree/InvenTree/pull/10111
- Adds "scheduled_to_build" annotated field to BuildLine serializer
v377 -> 2025-08-01 : https://github.com/inventree/InvenTree/pull/10109
- Allow email records to be deleted via the API

View File

@@ -1308,6 +1308,7 @@ class BuildLineSerializer(DataImportExportSerializerMixin, InvenTreeModelSeriali
# Annotated fields
'allocated',
'in_production',
'scheduled_to_build',
'on_order',
'available_stock',
'available_substitute_stock',
@@ -1438,13 +1439,12 @@ class BuildLineSerializer(DataImportExportSerializerMixin, InvenTreeModelSeriali
)
# Annotated (calculated) fields
# Total quantity of allocated stock
allocated = serializers.FloatField(label=_('Allocated Stock'), read_only=True)
on_order = serializers.FloatField(label=_('On Order'), read_only=True)
in_production = serializers.FloatField(label=_('In Production'), read_only=True)
scheduled_to_build = serializers.FloatField(
label=_('Scheduled to Build'), read_only=True
)
external_stock = serializers.FloatField(read_only=True, label=_('External Stock'))
available_stock = serializers.FloatField(read_only=True, label=_('Available Stock'))
@@ -1464,6 +1464,7 @@ class BuildLineSerializer(DataImportExportSerializerMixin, InvenTreeModelSeriali
- available: Total stock available for allocation against this build line
- on_order: Total stock on order for this build line
- in_production: Total stock currently in production for this build line
- scheduled_to_build: Total stock scheduled to be built for this build line
Arguments:
queryset: The queryset to annotate
@@ -1573,7 +1574,10 @@ class BuildLineSerializer(DataImportExportSerializerMixin, InvenTreeModelSeriali
# Annotate the "in_production" quantity
queryset = queryset.annotate(
in_production=part.filters.annotate_in_production_quantity(reference=ref)
in_production=part.filters.annotate_in_production_quantity(reference=ref),
scheduled_to_build=part.filters.annotate_scheduled_to_build_quantity(
reference=ref
),
)
# Annotate the "on_order" quantity