Add Meta subclass for build serializers (#7315)

Ref: https://github.com/inventree/InvenTree/discussions/7314
This commit is contained in:
Oliver 2024-05-24 09:13:57 +10:00 committed by GitHub
parent 2fafb7f21c
commit 0d46af7a74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -236,6 +236,16 @@ class BuildOutputCreateSerializer(serializers.Serializer):
The Build object is provided to the serializer context. The Build object is provided to the serializer context.
""" """
class Meta:
"""Serializer metaclass."""
fields = [
'quantity',
'batch_code',
'serial_numbers',
'location',
'auto_allocate',
]
quantity = serializers.DecimalField( quantity = serializers.DecimalField(
max_digits=15, max_digits=15,
decimal_places=5, decimal_places=5,
@ -638,6 +648,14 @@ class OverallocationChoice():
class BuildCompleteSerializer(serializers.Serializer): class BuildCompleteSerializer(serializers.Serializer):
"""DRF serializer for marking a BuildOrder as complete.""" """DRF serializer for marking a BuildOrder as complete."""
class Meta:
"""Serializer metaclass"""
fields = [
'accept_overallocated',
'accept_unallocated',
'accept_incomplete',
]
def get_context_data(self): def get_context_data(self):
"""Retrieve extra context data for this serializer. """Retrieve extra context data for this serializer.
@ -731,6 +749,13 @@ class BuildUnallocationSerializer(serializers.Serializer):
- bom_item: Filter against a particular BOM line item - bom_item: Filter against a particular BOM line item
""" """
class Meta:
"""Serializer metaclass"""
fields = [
'build_line',
'output',
]
build_line = serializers.PrimaryKeyRelatedField( build_line = serializers.PrimaryKeyRelatedField(
queryset=BuildLine.objects.all(), queryset=BuildLine.objects.all(),
many=False, many=False,