diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py index 2b2bdecbed..a18328be1a 100644 --- a/InvenTree/build/models.py +++ b/InvenTree/build/models.py @@ -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): """ diff --git a/InvenTree/build/templates/build/allocate.html b/InvenTree/build/templates/build/allocate.html index e811c37ce8..aa45aa5054 100644 --- a/InvenTree/build/templates/build/allocate.html +++ b/InvenTree/build/templates/build/allocate.html @@ -21,6 +21,7 @@ InvenTree | Allocate Parts {% else %}
+ {% if build.active %} @@ -32,6 +33,7 @@ InvenTree | Allocate Parts + {% endif %}

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