From 7b332d93ee8bc5f1d7c9cfeb1c25a89cb4ccc58a Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 8 Aug 2020 08:48:27 +1000 Subject: [PATCH 1/9] Rearrange button layouts --- .../stock/templates/stock/item_base.html | 21 ++++++++++++------- InvenTree/templates/js/stock.html | 8 +------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index a35b5f0346..8a57c8bdaf 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -86,30 +86,35 @@ InvenTree | {% trans "Stock Item" %} - {{ item }} {% endif %} - {% if item.in_stock %} - {% endif %} From a2c3c1086cea8515bc6cd9976531b5a73aba99bb Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 8 Aug 2020 09:31:57 +1000 Subject: [PATCH 8/9] Catch unhandled javascript errors --- InvenTree/stock/templates/stock/item_base.html | 2 +- InvenTree/templates/status_codes.html | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index 9b0b182848..ce055d65c5 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -161,7 +161,7 @@ InvenTree | {% trans "Stock Item" %} - {{ item }} {% trans "Customer" %} - {{ item.customer.name }} + {{ item.customer.name }} {% endif %} {% if item.belongs_to %} diff --git a/InvenTree/templates/status_codes.html b/InvenTree/templates/status_codes.html index 029252a842..f032f97309 100644 --- a/InvenTree/templates/status_codes.html +++ b/InvenTree/templates/status_codes.html @@ -18,14 +18,18 @@ function {{ label }}StatusDisplay(key) { key = String(key); - var value = {{ label }}Codes[key].value; + var value = null; + var label = null; + + if (key in {{ label }}Codes) { + value = {{ label }}Codes[key].value; + label = {{ label }}Codes[key].label; + } if (value == null || value.length == 0) { value = key; + label = ''; } - // Select the label color - var label = {{ label }}Codes[key].label ?? ''; - return `${value}`; } From 8d9cfd3678f722c2454a801a08c86da21d49acf6 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 8 Aug 2020 09:44:21 +1000 Subject: [PATCH 9/9] Migration file for StockStatus codes --- .../migrations/0048_auto_20200807_2344.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 InvenTree/stock/migrations/0048_auto_20200807_2344.py diff --git a/InvenTree/stock/migrations/0048_auto_20200807_2344.py b/InvenTree/stock/migrations/0048_auto_20200807_2344.py new file mode 100644 index 0000000000..b859344bb0 --- /dev/null +++ b/InvenTree/stock/migrations/0048_auto_20200807_2344.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0.7 on 2020-08-07 23:44 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0047_auto_20200605_0932'), + ] + + 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'), (85, 'Returned')], default=10, validators=[django.core.validators.MinValueValidator(0)]), + ), + ]