From 09a4fab0d64c89f50da8a38189a102f32ae8fcd3 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 27 May 2022 15:12:15 +1000 Subject: [PATCH] Adds 'quarantine' code for StockItemStatus (#3084) * Adds 'quarantine' code for StockItemStatus - Marks item as "unavailable" - Removes unused code from StockItemStatus class * Add migration file --- InvenTree/InvenTree/status_codes.py | 23 +++---------------- .../migrations/0076_alter_stockitem_status.py | 19 +++++++++++++++ 2 files changed, 22 insertions(+), 20 deletions(-) create mode 100644 InvenTree/stock/migrations/0076_alter_stockitem_status.py diff --git a/InvenTree/InvenTree/status_codes.py b/InvenTree/InvenTree/status_codes.py index 57bacc861e..15f3d872bb 100644 --- a/InvenTree/InvenTree/status_codes.py +++ b/InvenTree/InvenTree/status_codes.py @@ -173,12 +173,9 @@ class StockStatus(StatusCode): DESTROYED = 60 # Item is destroyed REJECTED = 65 # Item is rejected LOST = 70 # Item has been lost + QUARANTINED = 75 # Item has been quarantined and is unavailable RETURNED = 85 # Item has been returned from a customer - # Any stock code above 100 means that the stock item is not "in stock" - # This can be used as a quick check for filtering - NOT_IN_STOCK = 100 - options = { OK: _("OK"), ATTENTION: _("Attention needed"), @@ -186,6 +183,7 @@ class StockStatus(StatusCode): DESTROYED: _("Destroyed"), LOST: _("Lost"), REJECTED: _("Rejected"), + QUARANTINED: _("Quarantined"), RETURNED: _("Returned"), } @@ -196,6 +194,7 @@ class StockStatus(StatusCode): DESTROYED: 'danger', LOST: 'dark', REJECTED: 'danger', + QUARANTINED: 'info' } # The following codes correspond to parts that are 'available' or 'in stock' @@ -206,22 +205,6 @@ class StockStatus(StatusCode): RETURNED, ] - # The following codes correspond to parts that are 'unavailable' - UNAVAILABLE_CODES = [ - DESTROYED, - LOST, - REJECTED, - ] - - # The following codes are available for receiving goods - RECEIVING_CODES = [ - OK, - ATTENTION, - DAMAGED, - DESTROYED, - REJECTED - ] - class StockHistoryCode(StatusCode): diff --git a/InvenTree/stock/migrations/0076_alter_stockitem_status.py b/InvenTree/stock/migrations/0076_alter_stockitem_status.py new file mode 100644 index 0000000000..625fa372b6 --- /dev/null +++ b/InvenTree/stock/migrations/0076_alter_stockitem_status.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.13 on 2022-05-27 04:40 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0075_auto_20220515_1440'), + ] + + operations = [ + migrations.AlterField( + model_name='stockitem', + name='status', + field=models.PositiveIntegerField(choices=[(10, 'OK'), (50, 'Attention needed'), (55, 'Damaged'), (60, 'Destroyed'), (70, 'Lost'), (65, 'Rejected'), (75, 'Quarantined'), (85, 'Returned')], default=10, validators=[django.core.validators.MinValueValidator(0)]), + ), + ]