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:
@ -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 """
|
||||
|
@ -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.
|
||||
|
||||
|
Reference in New Issue
Block a user