From 37fba52e3deb202a071647b6dfe5758475aa4919 Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 22 Dec 2022 12:42:24 +1100 Subject: [PATCH] Add indication that a stock item has not been updated recently --- InvenTree/templates/js/translated/part.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/InvenTree/templates/js/translated/part.js b/InvenTree/templates/js/translated/part.js index 1a78e945bc..479e3b1e05 100644 --- a/InvenTree/templates/js/translated/part.js +++ b/InvenTree/templates/js/translated/part.js @@ -725,6 +725,8 @@ function performStocktake(partId, options={}) { var part_quantity = 0; + var date_threshold = moment().subtract(30, "days"); + // Helper function for formatting a StockItem row function buildStockItemRow(item) { @@ -748,7 +750,15 @@ function performStocktake(partId, options={}) { quantity += stockStatusDisplay(item.status, {classes: 'float-right'}); // Last update - var updated = item.updated || item.stocktake_date; + var updated = item.stocktake_date || item.updated; + + var update_rendered = renderDate(updated); + + if (updated) { + if (moment(updated) < date_threshold) { + update_rendered += `
`; + } + } // Actions var actions = ''; @@ -758,7 +768,7 @@ function performStocktake(partId, options={}) { ${part} ${location} ${quantity} - ${renderDate(updated)} + ${update_rendered} ${actions} `; } @@ -772,6 +782,7 @@ function performStocktake(partId, options={}) { location_detail: true, part_detail: true, include_variants: true, + ordering: '-stock', }, { success: function(response) {