Optionally show/hide the "accept_overallocated" dialog option (#3290)

This commit is contained in:
Oliver 2022-07-04 12:51:51 +10:00 committed by GitHub
parent fd03b4068d
commit 5045f85346
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -1018,7 +1018,7 @@ class Build(MPTTModel, ReferenceIndexingMixin):
"""Returns True if the un-tracked parts are fully allocated for this BuildOrder."""
return self.is_fully_allocated(None)
def has_overallocated_parts(self, output):
def has_overallocated_parts(self, output=None):
"""Check if parts have been 'over-allocated' against the specified output.
Note: If output=None, test un-tracked parts

View File

@ -236,6 +236,7 @@ src="{% static 'img/blank_image.png' %}"
{% else %}
completeBuildOrder({{ build.pk }}, {
overallocated: {% if build.has_overallocated_parts %}true{% else %}false{% endif %},
allocated: {% if build.are_untracked_parts_allocated %}true{% else %}false{% endif %},
completed: {% if build.remaining == 0 %}true{% else %}false{% endif %},
});

View File

@ -211,6 +211,10 @@ function completeBuildOrder(build_id, options={}) {
delete fields.accept_incomplete;
}
if (!options.overallocated) {
delete fields.accept_overallocated;
}
constructForm(url, {
fields: fields,
reload: true,