mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #2584 from SchrodingersGat/build-output-requires
Build output requires
This commit is contained in:
commit
dd3ac58f38
@ -437,6 +437,9 @@ class Build(MPTTModel, ReferenceIndexingMixin):
|
||||
def output_count(self):
|
||||
return self.build_outputs.count()
|
||||
|
||||
def has_build_outputs(self):
|
||||
return self.output_count > 0
|
||||
|
||||
def get_build_outputs(self, **kwargs):
|
||||
"""
|
||||
Return a list of build outputs.
|
||||
|
@ -284,6 +284,9 @@ class BuildCompleteSerializer(serializers.Serializer):
|
||||
if build.incomplete_count > 0:
|
||||
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
|
||||
|
||||
def save(self):
|
||||
|
@ -90,6 +90,11 @@ src="{% static 'img/blank_image.png' %}"
|
||||
</table>
|
||||
|
||||
<div class='info-messages'>
|
||||
{% if not build.has_build_outputs %}
|
||||
<div class='alert alert-block alert-danger'>
|
||||
{% trans "No build outputs have been created for this build order" %}<br>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if build.sales_order %}
|
||||
<div class='alert alert-block alert-info'>
|
||||
{% object_link 'so-detail' build.sales_order.id build.sales_order as link %}
|
||||
|
Loading…
Reference in New Issue
Block a user