Display expiry status on StockItem page

- Also adds ability to filter Stock table by expired status
This commit is contained in:
Oliver Walters 2021-01-04 00:21:47 +11:00
parent 39b9dcfec9
commit a0c95579b4
3 changed files with 24 additions and 0 deletions

View File

@ -71,6 +71,9 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
<h3>
{% trans "Stock Item" %}
{% stock_status_label item.status large=True %}
{% if item.is_expired %}
<span class='label label-large label-large-red'>{% trans "Expired" %}</span>
{% endif %}
</h3>
<hr>
<h4>
@ -293,6 +296,18 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
<td><a href="{% url 'supplier-part-detail' item.supplier_part.id %}">{{ item.supplier_part.SKU }}</a></td>
</tr>
{% endif %}
{% if item.expiry_date %}
<tr>
<td><span class='fas fa-calendar-alt{% if item.is_expired %} icon-red{% endif %}'></span></td>
<td>{% trans "Expiry Date" %}</td>
<td>
{{ item.expiry_date }}
{% if item.is_expired %}
<span title='[% trans "This StockItem expired on" %} {{ item.expiry_date }}' class='label label-red'>{% trans "Expired" %}</span>
{% endif %}
</td>
</tr>
{% endif %}
<tr>
<td><span class='fas fa-calendar-alt'></span></td>
<td>{% trans "Last Updated" %}</td>

View File

@ -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" %}');
}

View File

@ -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" %}',