mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1105 from SchrodingersGat/build-fix-fixes
Set the specified location of a build output
This commit is contained in:
commit
7e4b84f016
@ -66,7 +66,7 @@ class BuildOutputCreateForm(HelperForm):
|
||||
'serial_numbers': 'fa-hashtag',
|
||||
}
|
||||
|
||||
quantity = forms.IntegerField(
|
||||
output_quantity = forms.IntegerField(
|
||||
label=_('Quantity'),
|
||||
help_text=_('Enter quantity for build output'),
|
||||
)
|
||||
@ -86,7 +86,7 @@ class BuildOutputCreateForm(HelperForm):
|
||||
class Meta:
|
||||
model = Build
|
||||
fields = [
|
||||
'quantity',
|
||||
'output_quantity',
|
||||
'batch',
|
||||
'serial_numbers',
|
||||
'confirm',
|
||||
|
@ -182,6 +182,14 @@ class Build(MPTTModel):
|
||||
blank=True, help_text=_('Extra build notes')
|
||||
)
|
||||
|
||||
@property
|
||||
def active(self):
|
||||
"""
|
||||
Return True if this build is active
|
||||
"""
|
||||
|
||||
return self.status in BuildStatus.ACTIVE_CODES
|
||||
|
||||
@property
|
||||
def bom_items(self):
|
||||
"""
|
||||
@ -594,6 +602,9 @@ class Build(MPTTModel):
|
||||
- Mark the output as complete
|
||||
"""
|
||||
|
||||
# Select the location for the build output
|
||||
location = kwargs.get('location', self.destination)
|
||||
|
||||
# List the allocated BuildItem objects for the given output
|
||||
allocated_items = output.items_to_install.all()
|
||||
|
||||
@ -613,6 +624,7 @@ class Build(MPTTModel):
|
||||
# Ensure that the output is updated correctly
|
||||
output.build = self
|
||||
output.is_building = False
|
||||
output.location = location
|
||||
|
||||
output.save()
|
||||
|
||||
|
@ -21,6 +21,7 @@ InvenTree | Allocate Parts
|
||||
</div>
|
||||
{% else %}
|
||||
<div class='btn-group' role='group'>
|
||||
{% if build.active %}
|
||||
<button class='btn btn-primary' type='button' id='btn-create-output' title='{% trans "Create new build output" %}'>
|
||||
<span class='fas fa-plus-circle'></span> {% trans "Create New Output" %}
|
||||
</button>
|
||||
@ -32,6 +33,7 @@ InvenTree | Allocate Parts
|
||||
<button class='btn btn-danger' type='button' id='btn-unallocate' title='{% trans "Unallocate stock" %}'>
|
||||
<span class='fas fa-minus-circle'></span> {% trans "Unallocate Stock" %}
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
@ -74,7 +76,7 @@ InvenTree | Allocate Parts
|
||||
);
|
||||
{% endfor %}
|
||||
|
||||
{% if build.status == BuildStatus.PENDING %}
|
||||
{% if build.active %}
|
||||
$("#btn-allocate").on('click', function() {
|
||||
launchModalForm(
|
||||
"{% url 'build-auto-allocate' build.id %}",
|
||||
|
@ -188,7 +188,7 @@ class BuildOutputCreate(AjaxUpdateView):
|
||||
Validation for the form:
|
||||
"""
|
||||
|
||||
quantity = form.cleaned_data.get('quantity', None)
|
||||
quantity = form.cleaned_data.get('output_quantity', None)
|
||||
serials = form.cleaned_data.get('serial_numbers', None)
|
||||
|
||||
# Check that the serial numbers are valid
|
||||
@ -222,7 +222,7 @@ class BuildOutputCreate(AjaxUpdateView):
|
||||
|
||||
data = form.cleaned_data
|
||||
|
||||
quantity = data.get('quantity', None)
|
||||
quantity = data.get('output_quantity', None)
|
||||
batch = data.get('batch', None)
|
||||
|
||||
serials = data.get('serial_numbers', None)
|
||||
|
Loading…
Reference in New Issue
Block a user