From beac7d15df1eccc7543c7ca7598cf6d7c8a29521 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 8 Mar 2023 23:18:22 +1100 Subject: [PATCH] Bug fix for units text in part label (#4470) - Display even if no other badges are rendered - Fixes https://github.com/inventree/InvenTree/issues/4467 --- InvenTree/templates/js/translated/part.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/InvenTree/templates/js/translated/part.js b/InvenTree/templates/js/translated/part.js index db75386118..0648798316 100644 --- a/InvenTree/templates/js/translated/part.js +++ b/InvenTree/templates/js/translated/part.js @@ -679,19 +679,19 @@ function partStockLabel(part, options={}) { bg_class = 'bg-success'; } - // Display units next to stock badge - let unit_badge = ''; + let output = ''; + // Display units next to stock badge if (units && !options.no_units) { - unit_badge = `{% trans "Unit" %}: ${units} `; + output += `{% trans "Unit" %}: ${units} `; } if (elements.length > 0) { let text = elements.join(' | '); - return `${unit_badge}${text}`; - } else { - return ''; + output += `${text}`; } + + return output; }