Add UUID field to StockItem model

This commit is contained in:
Oliver Walters 2019-04-13 01:12:47 +10:00
parent b0f42fd30f
commit b64e584b52
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,19 @@
# Generated by Django 2.2 on 2019-04-12 15:06
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('stock', '0005_stockitemtracking_quantity'),
]
operations = [
migrations.AddField(
model_name='stockitem',
name='uuid',
field=models.UUIDField(blank=True, default=uuid.uuid4, editable=False),
),
]

View File

@ -11,6 +11,7 @@ from django.db.models.signals import pre_delete
from django.dispatch import receiver
from datetime import datetime
import uuid
from InvenTree.models import InvenTreeTree
@ -116,6 +117,9 @@ class StockItem(models.Model):
('part', 'serial'),
]
# UUID for generating QR codes
uuid = models.UUIDField(default=uuid.uuid4, blank=True, editable=False)
# The 'master' copy of the part of which this stock item is an instance
part = models.ForeignKey('part.Part', on_delete=models.CASCADE, related_name='locations')