2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 21:15:41 +00:00

Refactor: Add "makeIconBadge" javascript function

This commit is contained in:
Oliver Walters
2020-10-24 00:33:30 +11:00
parent ea7b1b65d6
commit b45a11aa3d
5 changed files with 40 additions and 26 deletions

View File

@ -567,7 +567,7 @@ class Build(MPTTModel):
required = self.getRequiredQuantity(part, output=output)
allocated = self.getAllocatedQuantity(part, output=output)
return max(required-allocated, 0)
return max(required - allocated, 0)
@property
def required_parts(self):
@ -618,7 +618,6 @@ class Build(MPTTModel):
return items
@property
def can_build(self):
""" Return true if there are enough parts to supply build """

View File

@ -179,11 +179,15 @@ class BuildOutputDelete(AjaxUpdateView):
valid = False
if output:
build.deleteBuildOutput(output)
valid = True
if confirm:
if output:
build.deleteBuildOutput(output)
valid = True
else:
form.non_field_errors = [_('Build or output not specified')]
else:
form.non_field_errors = [_('Build or output not specified')]
form.errors['confirm'] = [_('Confirm unallocation of build stock')]
form.non_field_errors = [_('Check the confirmation box')]
data = {
'form_valid': valid,
@ -191,6 +195,7 @@ class BuildOutputDelete(AjaxUpdateView):
return self.renderJsonResponse(request, form, data)
class BuildUnallocate(AjaxUpdateView):
""" View to un-allocate all parts from a build.