2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 05:25:42 +00:00

Annotate stock queryset with stale status

This commit is contained in:
Oliver Walters
2021-01-06 23:06:49 +11:00
parent a5b18640af
commit 1d6a049c5a
4 changed files with 30 additions and 1 deletions

View File

@ -102,6 +102,7 @@ loadStockTable($("#expired-stock-table"), {
loadStockTable($("#stale-stock-table"), {
params: {
stale: true,
expired: false,
location_detail: true,
part_detail: true,
},

View File

@ -534,7 +534,9 @@ function loadStockTable(table, options) {
}
if (row.expired) {
html += makeIconBadge('fa-stopwatch icon-red', '{% trans "Stock item has expired" %}');
html += makeIconBadge('fa-calendar-times icon-red', '{% trans "Stock item has expired" %}');
} else if (row.stale) {
html += makeIconBadge('fa-stopwatch', '{% trans "Stock item will expire soon" %}');
}
if (row.allocated) {

View File

@ -111,6 +111,11 @@ function getAvailableTableFilters(tableKey) {
title: '{% trans "Expired" %}',
description: '{% trans "Show stock items which have expired" %}',
},
stale: {
type: 'bool',
title: '{% trans "Stale" %}',
description: '{% trans "Show stock which is close to expiring" %}',
},
in_stock: {
type: 'bool',
title: '{% trans "In Stock" %}',