2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-03 04:00:57 +00:00

Add new fields for Part object

- Creation date
- Creation user
- Responsible user
This commit is contained in:
Oliver Walters
2020-03-18 21:50:18 +11:00
parent febd1ad4a7
commit 2b08b0f2b9
2 changed files with 40 additions and 0 deletions

View File

@ -226,6 +226,9 @@ class Part(models.Model):
active: Is this part active? Parts are deactivated instead of being deleted
virtual: Is this part "virtual"? e.g. a software product or similar
notes: Additional notes field for this part
creation_date: Date that this part was added to the database
creation_user: User who added this part to the database
responsible: User who is responsible for this part (optional)
"""
class Meta:
@ -448,6 +451,12 @@ class Part(models.Model):
bom_checked_date = models.DateField(blank=True, null=True)
creation_date = models.DateField(auto_now_add=True, editable=False, blank=True, null=True)
creation_user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True, related_name='parts_created')
responsible = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True, related_name='parts_responible')
def format_barcode(self):
""" Return a JSON string for formatting a barcode for this Part object """