mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 12:35:46 +00:00
Allow completion of partially allocated build outputs
- Requires manual acceptance from user
This commit is contained in:
@ -452,7 +452,7 @@ class BuildItemList(generics.ListCreateAPIView):
|
||||
if tracked:
|
||||
queryset = queryset.exclude(install_into=None)
|
||||
else:
|
||||
queryset = queryest.filter(install_into=None)
|
||||
queryset = queryset.filter(install_into=None)
|
||||
|
||||
# Filter by output target
|
||||
output = params.get('output', None)
|
||||
|
@ -161,7 +161,12 @@ class BuildOutputSerializer(serializers.Serializer):
|
||||
|
||||
# The build output must have all tracked parts allocated
|
||||
if not build.is_fully_allocated(output):
|
||||
raise ValidationError(_("This build output is not fully allocated"))
|
||||
|
||||
# Check if the user has specified that incomplete allocations are ok
|
||||
accept_incomplete = InvenTree.helpers.str2bool(self.context['request'].data.get('accept_incomplete_allocation', False))
|
||||
|
||||
if not accept_incomplete:
|
||||
raise ValidationError(_("This build output is not fully allocated"))
|
||||
|
||||
return output
|
||||
|
||||
@ -355,6 +360,7 @@ class BuildOutputCompleteSerializer(serializers.Serializer):
|
||||
'outputs',
|
||||
'location',
|
||||
'status',
|
||||
'accept_incomplete_allocation',
|
||||
'notes',
|
||||
]
|
||||
|
||||
@ -377,6 +383,13 @@ class BuildOutputCompleteSerializer(serializers.Serializer):
|
||||
label=_("Status"),
|
||||
)
|
||||
|
||||
accept_incomplete_allocation = serializers.BooleanField(
|
||||
default=False,
|
||||
required=False,
|
||||
label=_('Accept Incomplete Allocation'),
|
||||
help_text=_('Complete ouputs if stock has not been fully allocated'),
|
||||
)
|
||||
|
||||
notes = serializers.CharField(
|
||||
label=_("Notes"),
|
||||
required=False,
|
||||
|
Reference in New Issue
Block a user