From a2c3c1086cea8515bc6cd9976531b5a73aba99bb Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 8 Aug 2020 09:31:57 +1000 Subject: [PATCH] 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}`; }