mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-16 20:15:44 +00:00
Throw validation error if no build outputs have been started
This commit is contained in:
@ -437,6 +437,9 @@ class Build(MPTTModel, ReferenceIndexingMixin):
|
|||||||
def output_count(self):
|
def output_count(self):
|
||||||
return self.build_outputs.count()
|
return self.build_outputs.count()
|
||||||
|
|
||||||
|
def has_build_outputs(self):
|
||||||
|
return self.output_count > 0
|
||||||
|
|
||||||
def get_build_outputs(self, **kwargs):
|
def get_build_outputs(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
Return a list of build outputs.
|
Return a list of build outputs.
|
||||||
|
@ -284,6 +284,9 @@ class BuildCompleteSerializer(serializers.Serializer):
|
|||||||
if build.incomplete_count > 0:
|
if build.incomplete_count > 0:
|
||||||
raise ValidationError(_("Build order has incomplete outputs"))
|
raise ValidationError(_("Build order has incomplete outputs"))
|
||||||
|
|
||||||
|
if not build.has_build_outputs():
|
||||||
|
raise ValidationError(_("No build outputs have been created for this build order"))
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
|
Reference in New Issue
Block a user