2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-12 10:05:39 +00:00

Added PartRevision model

- Added 'trackable' field to Part
This commit is contained in:
Oliver Walters
2017-03-28 18:17:32 +11:00
parent 6aa9f14b46
commit be030991a5
3 changed files with 31 additions and 4 deletions

View File

@ -22,6 +22,7 @@ class Part(models.Model):
category = models.ForeignKey(PartCategory, on_delete=models.CASCADE)
minimum_stock = models.IntegerField(default=0)
units = models.CharField(max_length=20, default="pcs", blank=True)
trackable = models.BooleanField(default=False)
def __str__(self):
if self.IPN:
@ -35,4 +36,18 @@ class Part(models.Model):
verbose_name = "Part"
verbose_name_plural = "Parts"
class PartRevision(models.Model):
""" A PartRevision represents a change-notification to a Part
A Part may go through several revisions in its lifetime,
which should be tracked.
UniqueParts can have a single associated PartRevision
"""
part = models.ForeignKey(Part, on_delete=models.CASCADE)
name = models.CharField(max_length=100)
description = models.CharField(max_length=500)
revision_date = models.DateField(auto_now_add = True)
def __str__(self):
return self.name