From a0c95579b42042ed992a3edb165a4aeb5d352b98 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 4 Jan 2021 00:21:47 +1100 Subject: [PATCH] Display expiry status on StockItem page - Also adds ability to filter Stock table by expired status --- InvenTree/stock/templates/stock/item_base.html | 15 +++++++++++++++ InvenTree/templates/js/stock.js | 4 ++++ InvenTree/templates/js/table_filters.js | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index 74e93fecc0..4d773b047d 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -71,6 +71,9 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}

{% trans "Stock Item" %} {% stock_status_label item.status large=True %} + {% if item.is_expired %} + {% trans "Expired" %} + {% endif %}


@@ -293,6 +296,18 @@ InvenTree | {% trans "Stock Item" %} - {{ item }} {{ item.supplier_part.SKU }} {% endif %} + {% if item.expiry_date %} + + + {% trans "Expiry Date" %} + + {{ item.expiry_date }} + {% if item.is_expired %} + {% trans "Expired" %} + {% endif %} + + + {% endif %} {% trans "Last Updated" %} diff --git a/InvenTree/templates/js/stock.js b/InvenTree/templates/js/stock.js index f8a7c38d2c..65df58c4b6 100644 --- a/InvenTree/templates/js/stock.js +++ b/InvenTree/templates/js/stock.js @@ -532,6 +532,10 @@ function loadStockTable(table, options) { html += makeIconBadge('fa-user', '{% trans "Stock item assigned to customer" %}'); } + if (row.expired) { + html += makeIconBadge('fa-stopwatch icon-red', '{% trans "Stock item has expired" %}'); + } + if (row.allocated) { html += makeIconBadge('fa-bookmark', '{% trans "Stock item has been allocated" %}'); } diff --git a/InvenTree/templates/js/table_filters.js b/InvenTree/templates/js/table_filters.js index d2ea26d8c3..054542a4a3 100644 --- a/InvenTree/templates/js/table_filters.js +++ b/InvenTree/templates/js/table_filters.js @@ -106,6 +106,11 @@ function getAvailableTableFilters(tableKey) { title: '{% trans "Depleted" %}', description: '{% trans "Show stock items which are depleted" %}', }, + expired: { + type: 'bool', + title: '{% trans "Expired" %}', + description: '{% trans "Show stock items which have expired" %}', + }, in_stock: { type: 'bool', title: '{% trans "In Stock" %}',