mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix some build status code thingies
This commit is contained in:
parent
f731c45ce8
commit
4f1acddb5d
@ -6,6 +6,8 @@ from django.test import TestCase
|
||||
from .models import Build
|
||||
from part.models import Part
|
||||
|
||||
from InvenTree.status_codes import BuildStatus
|
||||
|
||||
|
||||
class BuildTestSimple(TestCase):
|
||||
|
||||
@ -14,14 +16,14 @@ class BuildTestSimple(TestCase):
|
||||
description='Simple description')
|
||||
Build.objects.create(part=part,
|
||||
batch='B1',
|
||||
status=Build.PENDING,
|
||||
status=BuildStatus.PENDING,
|
||||
title='Building 7 parts',
|
||||
quantity=7,
|
||||
notes='Some simple notes')
|
||||
|
||||
Build.objects.create(part=part,
|
||||
batch='B2',
|
||||
status=Build.COMPLETE,
|
||||
status=BuildStatus.COMPLETE,
|
||||
title='Building 21 parts',
|
||||
quantity=21,
|
||||
notes='Some simple notes')
|
||||
|
@ -15,6 +15,7 @@ from stock.models import StockLocation, StockItem
|
||||
|
||||
from InvenTree.views import AjaxUpdateView, AjaxCreateView, AjaxDeleteView
|
||||
from InvenTree.helpers import str2bool
|
||||
from InvenTree.status_codes import BuildStatus
|
||||
|
||||
|
||||
class BuildIndex(ListView):
|
||||
@ -32,10 +33,12 @@ class BuildIndex(ListView):
|
||||
|
||||
context = super(BuildIndex, self).get_context_data(**kwargs).copy()
|
||||
|
||||
context['active'] = self.get_queryset().filter(status__in=[Build.PENDING, ])
|
||||
context['BuildStatus'] = BuildStatus
|
||||
|
||||
context['completed'] = self.get_queryset().filter(status=Build.COMPLETE)
|
||||
context['cancelled'] = self.get_queryset().filter(status=Build.CANCELLED)
|
||||
context['active'] = self.get_queryset().filter(status__in=BuildStatus.ACTIVE_CODES)
|
||||
|
||||
context['completed'] = self.get_queryset().filter(status=BuildStatus.COMPLETE)
|
||||
context['cancelled'] = self.get_queryset().filter(status=BuildStatus.CANCELLED)
|
||||
|
||||
return context
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
{% if build.status == build.PENDING %}
|
||||
{% if build.status == BuildStatus.PENDING %}
|
||||
<span class='label label-large label-info'>
|
||||
{% elif build.status == build.ALLOCATED %}
|
||||
{% elif build.status == BuildStatus.ALLOCATED %}
|
||||
<span class='label label-large label-primary'>
|
||||
{% elif build.status == build.CANCELLED %}
|
||||
{% elif build.status == BuildStatus.CANCELLED %}
|
||||
<span class='label label-large label-danger'>
|
||||
{% elif build.status == build.COMPLETE %}
|
||||
{% elif build.status == BuildStatus.COMPLETE %}
|
||||
<span class='label label-large label-success'>
|
||||
{% endif %}
|
||||
{{ build.get_status_display }}
|
||||
|
Loading…
Reference in New Issue
Block a user