From d5459e5ddf067268ce45190a0fe786b806370adc Mon Sep 17 00:00:00 2001 From: simonkuehling Date: Mon, 13 Feb 2023 21:00:53 +0100 Subject: [PATCH] Show units next to [No Stock]-badge in part search (implements #4330) (#4339) --- InvenTree/templates/js/translated/part.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/InvenTree/templates/js/translated/part.js b/InvenTree/templates/js/translated/part.js index 1c0fa1460d..c4c0d115b5 100644 --- a/InvenTree/templates/js/translated/part.js +++ b/InvenTree/templates/js/translated/part.js @@ -617,7 +617,12 @@ function partStockLabel(part, options={}) { return `{% trans "Building" %}: ${part.building} ${units}`; } else { // There is no stock - return `{% trans "No Stock" %}`; + var unit_badge = ''; + if (units) { + // show units next to [No Stock] badge + unit_badge = `{% trans "Unit" %}: ${units} `; + } + return `${unit_badge}{% trans "No Stock" %}`; } }