2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 20:16:44 +00:00
# Conflicts:
#	InvenTree/customer/templates/customer/order_index.html
This commit is contained in:
James Newlands 2018-04-18 00:39:15 +10:00
commit cd903112cc
10 changed files with 18 additions and 36 deletions

View File

@ -1,18 +0,0 @@
import inspect
from enum import Enum
class ChoiceEnum(Enum):
""" Helper class to provide enumerated choice values for integer fields
"""
# http://blog.richard.do/index.php/2014/02/how-to-use-enums-for-django-field-choices/
@classmethod
def choices(cls):
# get all members of the class
members = inspect.getmembers(cls, lambda m: not(inspect.isroutine(m)))
# filter down to just properties
props = [m for m in members if not(m[0][:2] == '__')]
# format into django choice tuple
choices = tuple([(str(p[1].value), p[0]) for p in props])
return choices

View File

@ -18,4 +18,5 @@ class BuildAdmin(admin.ModelAdmin):
'notes',
)
admin.site.register(Build, BuildAdmin)

View File

@ -8,6 +8,7 @@ from django.core.validators import MinValueValidator
from part.models import Part
class Build(models.Model):
""" A Build object organises the creation of new parts from the component parts
It uses the part BOM to generate new parts.
@ -23,8 +24,7 @@ class Build(models.Model):
CANCELLED = 30 # Build was cancelled
COMPLETE = 40 # Build is complete
BUILD_STATUS_CODES = {
PENDING : _("Pending"),
BUILD_STATUS_CODES = {PENDING: _("Pending"),
HOLDING: _("Holding"),
CANCELLED: _("Cancelled"),
COMPLETE: _("Complete"),
@ -38,7 +38,6 @@ class Build(models.Model):
choices=BUILD_STATUS_CODES.items(),
validators=[MinValueValidator(0)])
# Date the build model was 'created'
creation_date = models.DateField(auto_now=True, editable=False)

View File

@ -12,6 +12,7 @@ from .models import Build
from .forms import EditBuildForm
class BuildIndex(ListView):
model = Build
template_name = 'build/index.html'

View File

@ -73,4 +73,3 @@ class CustomerOrderLine(models.Model):
# Line notes
notes = models.TextField(blank=True, help_text="Line notes")

View File

@ -1,3 +1,3 @@
from django.test import TestCase
# from django.test import TestCase
# Create your tests here.