Fixed bug where "New output" button stopped working

- Build status was changing from "PENDING" to "PRODUCTION"
- Created new check for active builds
This commit is contained in:
Oliver Walters 2020-11-05 15:57:46 +11:00
parent d44092b209
commit 2591d34260
2 changed files with 11 additions and 1 deletions

View File

@ -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):
"""

View File

@ -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 %}",