Annotate stock queryset with stale status

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

No files matched your search

+1
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,
},
+3 -1
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) {
+5
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" %}',