From ee28b4eea55e6f354531f125cb74af456ee320ff Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 5 Oct 2020 00:12:42 +1100 Subject: [PATCH] Add "is_building" field to StockItem model - This will be set to TRUE until a stock item has been completed --- .../migrations/0052_stockitem_is_building.py | 18 ++++++++++++++++++ InvenTree/stock/models.py | 5 +++++ 2 files changed, 23 insertions(+) create mode 100644 InvenTree/stock/migrations/0052_stockitem_is_building.py diff --git a/InvenTree/stock/migrations/0052_stockitem_is_building.py b/InvenTree/stock/migrations/0052_stockitem_is_building.py new file mode 100644 index 0000000000..46847992cc --- /dev/null +++ b/InvenTree/stock/migrations/0052_stockitem_is_building.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.7 on 2020-10-04 13:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0051_auto_20200928_0928'), + ] + + operations = [ + migrations.AddField( + model_name='stockitem', + name='is_building', + field=models.BooleanField(default=False), + ), + ] diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index b78b0e9410..75d38280d0 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -130,6 +130,7 @@ class StockItem(MPTTModel): status: Status of this StockItem (ref: InvenTree.status_codes.StockStatus) notes: Extra notes field build: Link to a Build (if this stock item was created from a build) + is_building: Boolean field indicating if this stock item is currently being built purchase_order: Link to a PurchaseOrder (if this stock item was created from a PurchaseOrder) infinite: If True this StockItem can never be exhausted sales_order: Link to a SalesOrder object (if the StockItem has been assigned to a SalesOrder) @@ -389,6 +390,10 @@ class StockItem(MPTTModel): related_name='build_outputs', ) + is_building = models.BooleanField( + default=False, + ) + purchase_order = models.ForeignKey( 'order.PurchaseOrder', on_delete=models.SET_NULL,