mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 04:26:44 +00:00
Allow completion of partially allocated build outputs
- Requires manual acceptance from user
This commit is contained in:
parent
72bcea2f6d
commit
f531e354b9
@ -452,7 +452,7 @@ class BuildItemList(generics.ListCreateAPIView):
|
|||||||
if tracked:
|
if tracked:
|
||||||
queryset = queryset.exclude(install_into=None)
|
queryset = queryset.exclude(install_into=None)
|
||||||
else:
|
else:
|
||||||
queryset = queryest.filter(install_into=None)
|
queryset = queryset.filter(install_into=None)
|
||||||
|
|
||||||
# Filter by output target
|
# Filter by output target
|
||||||
output = params.get('output', None)
|
output = params.get('output', None)
|
||||||
|
@ -161,7 +161,12 @@ class BuildOutputSerializer(serializers.Serializer):
|
|||||||
|
|
||||||
# The build output must have all tracked parts allocated
|
# The build output must have all tracked parts allocated
|
||||||
if not build.is_fully_allocated(output):
|
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
|
return output
|
||||||
|
|
||||||
@ -355,6 +360,7 @@ class BuildOutputCompleteSerializer(serializers.Serializer):
|
|||||||
'outputs',
|
'outputs',
|
||||||
'location',
|
'location',
|
||||||
'status',
|
'status',
|
||||||
|
'accept_incomplete_allocation',
|
||||||
'notes',
|
'notes',
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -377,6 +383,13 @@ class BuildOutputCompleteSerializer(serializers.Serializer):
|
|||||||
label=_("Status"),
|
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(
|
notes = serializers.CharField(
|
||||||
label=_("Notes"),
|
label=_("Notes"),
|
||||||
required=False,
|
required=False,
|
||||||
|
@ -427,6 +427,8 @@ function completeBuildOutputs(build_id, outputs, options={}) {
|
|||||||
fields: {
|
fields: {
|
||||||
status: {},
|
status: {},
|
||||||
location: {},
|
location: {},
|
||||||
|
notes: {},
|
||||||
|
accept_incomplete_allocation: {},
|
||||||
},
|
},
|
||||||
confirm: true,
|
confirm: true,
|
||||||
title: '{% trans "Complete Build Outputs" %}',
|
title: '{% trans "Complete Build Outputs" %}',
|
||||||
@ -445,6 +447,8 @@ function completeBuildOutputs(build_id, outputs, options={}) {
|
|||||||
outputs: [],
|
outputs: [],
|
||||||
status: getFormFieldValue('status', {}, opts),
|
status: getFormFieldValue('status', {}, opts),
|
||||||
location: getFormFieldValue('location', {}, opts),
|
location: getFormFieldValue('location', {}, opts),
|
||||||
|
notes: getFormFieldValue('notes', {}, opts),
|
||||||
|
accept_incomplete_allocation: getFormFieldValue('accept_incomplete_allocation', {type: 'boolean'}, opts),
|
||||||
};
|
};
|
||||||
|
|
||||||
var output_pk_values = [];
|
var output_pk_values = [];
|
||||||
@ -1896,8 +1900,6 @@ function allocateStockToBuild(build_id, part_id, bom_items, options={}) {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
fields: {},
|
fields: {},
|
||||||
preFormContent: html,
|
preFormContent: html,
|
||||||
confirm: true,
|
|
||||||
confirmMessage: '{% trans "Confirm stock allocation" %}',
|
|
||||||
title: '{% trans "Allocate Stock Items to Build Order" %}',
|
title: '{% trans "Allocate Stock Items to Build Order" %}',
|
||||||
afterRender: function(fields, options) {
|
afterRender: function(fields, options) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user