From ba4a1fd7711b523ab38953d40a1920ac81093f38 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 14 Apr 2020 22:54:05 +1000 Subject: [PATCH] Add a 'uid' field to StockItem model - To be used for barcode asociation and lookup --- .../stock/migrations/0026_stockitem_uid.py | 18 ++++++++++++++++++ InvenTree/stock/models.py | 3 +++ 2 files changed, 21 insertions(+) create mode 100644 InvenTree/stock/migrations/0026_stockitem_uid.py diff --git a/InvenTree/stock/migrations/0026_stockitem_uid.py b/InvenTree/stock/migrations/0026_stockitem_uid.py new file mode 100644 index 0000000000..c00e858815 --- /dev/null +++ b/InvenTree/stock/migrations/0026_stockitem_uid.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.10 on 2020-04-14 12:53 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0025_auto_20200405_2243'), + ] + + operations = [ + migrations.AddField( + model_name='stockitem', + name='uid', + field=models.CharField(blank=True, help_text='Unique identifier field', max_length=128), + ), + ] diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index f7d1c0b147..51b61ff3fd 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -108,6 +108,7 @@ class StockItem(MPTTModel): Attributes: parent: Link to another StockItem from which this StockItem was created + uid: Field containing a unique-id which is mapped to a third-party identifier (e.g. a barcode) part: Link to the master abstract part that this StockItem is an instance of supplier_part: Link to a specific SupplierPart (optional) location: Where this StockItem is located @@ -295,6 +296,8 @@ class StockItem(MPTTModel): } ) + uid = models.CharField(blank=True, max_length=128, help_text=("Unique identifier field")) + parent = TreeForeignKey('self', on_delete=models.DO_NOTHING, blank=True, null=True,