2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-01 13:06:45 +00:00

PEP fixes

This commit is contained in:
Oliver Walters 2017-03-28 23:09:51 +11:00
parent f4ef9d938e
commit 09cb067627
2 changed files with 37 additions and 34 deletions

View File

@ -5,15 +5,18 @@ from django.db import models
from InvenTree.models import Company from InvenTree.models import Company
from part.models import Part from part.models import Part
class Supplier(Company): class Supplier(Company):
""" Represents a manufacturer or supplier """ Represents a manufacturer or supplier
""" """
pass pass
class Customer(Company): class Customer(Company):
pass pass
class SupplierPart(models.Model): class SupplierPart(models.Model):
""" Represents a unique part as provided by a Supplier """ Represents a unique part as provided by a Supplier
Each SupplierPart is identified by a MPN (Manufacturer Part Number) Each SupplierPart is identified by a MPN (Manufacturer Part Number)
@ -52,7 +55,7 @@ class SupplierPriceBreak(models.Model):
def __str__(self): def __str__(self):
return "{mpn} - {cost}{currency} @ {quan}".format( return "{mpn} - {cost}{currency} @ {quan}".format(
mpn = part.MPN, mpn=part.MPN,
cost = self.cost, cost=self.cost,
currency = self.currency if self.currency else '', currency=self.currency if self.currency else '',
quan = self.quantity) quan=self.quantity)

View File

@ -6,6 +6,7 @@ from django.contrib.auth.models import User
from supplier.models import Customer from supplier.models import Customer
from part.models import Part, PartRevision from part.models import Part, PartRevision
class UniquePart(models.Model): class UniquePart(models.Model):
""" A unique instance of a Part object. """ A unique instance of a Part object.
Used for tracking parts based on serial numbers, Used for tracking parts based on serial numbers,
@ -20,7 +21,7 @@ class UniquePart(models.Model):
null=True) null=True)
creation_date = models.DateField(auto_now_add=True, creation_date = models.DateField(auto_now_add=True,
editable=False) editable=False)
serial = models.IntegerField() serial = models.IntegerField()
createdBy = models.ForeignKey(User) createdBy = models.ForeignKey(User)
@ -36,18 +37,19 @@ class UniquePart(models.Model):
PART_DESTROYED = 50 PART_DESTROYED = 50
status = models.IntegerField(default=PART_IN_PROGRESS, status = models.IntegerField(default=PART_IN_PROGRESS,
choices=[ choices=[
(PART_IN_PROGRESS, "In progress"), (PART_IN_PROGRESS, "In progress"),
(PART_IN_STOCK, "In stock"), (PART_IN_STOCK, "In stock"),
(PART_SHIPPED, "Shipped"), (PART_SHIPPED, "Shipped"),
(PART_RETURNED, "Returned"), (PART_RETURNED, "Returned"),
(PART_DAMAGED, "Damaged"), (PART_DAMAGED, "Damaged"),
(PART_DESTROYED, "Destroyed"), (PART_DESTROYED, "Destroyed"),
]) ])
def __str__(self): def __str__(self):
return self.part.name return self.part.name
class PartTrackingInfo(models.Model): class PartTrackingInfo(models.Model):
""" Single data-point in the life of a UniquePart """ Single data-point in the life of a UniquePart
Each time something happens to the UniquePart, Each time something happens to the UniquePart,
@ -58,5 +60,3 @@ class PartTrackingInfo(models.Model):
date = models.DateField(auto_now_add=True, date = models.DateField(auto_now_add=True,
editable=False) editable=False)
notes = models.CharField(max_length=500) notes = models.CharField(max_length=500)