diff --git a/InvenTree/templates/js/translated/helpers.js b/InvenTree/templates/js/translated/helpers.js index 7d8e4400b0..4748a1e9d6 100644 --- a/InvenTree/templates/js/translated/helpers.js +++ b/InvenTree/templates/js/translated/helpers.js @@ -37,6 +37,8 @@ /* exported makeIcon, + trueFalseLabel, + yesNoLabel, */ @@ -87,6 +89,14 @@ function yesNoLabel(value, options={}) { } +function trueFalseLabel(value, options={}) { + options.pass = '{% trans "True" %}'; + options.fail = '{% trans "False" %}'; + + return yesNoLabel(value, options); +} + + function editButton(url, text='{% trans "Edit" %}') { return ``; } diff --git a/InvenTree/templates/js/translated/part.js b/InvenTree/templates/js/translated/part.js index 82de36520e..f3070899b8 100644 --- a/InvenTree/templates/js/translated/part.js +++ b/InvenTree/templates/js/translated/part.js @@ -44,6 +44,7 @@ showMessage, showModalSpinner, thumbnailImage, + trueFalseLabel, updateFieldValue, withTitle, wrapButtons, @@ -1468,10 +1469,7 @@ function loadPartParameterTable(table, options) { let template = row.template_detail; if (template.checkbox) { - return yesNoLabel(value, { - pass: '{% trans "True" %}', - fail: '{% trans "False" %}', - }); + return trueFalseLabel(value); } if (row.data_numeric && row.template_detail.units) { @@ -2019,6 +2017,18 @@ function loadParametricPartTable(table, options={}) { template_name += ` [${template.units}]`; } + let fmt_func = null; + + if (template.checkbox) { + fmt_func = function(value) { + if (value == null) { + return null; + } else { + return trueFalseLabel(value); + } + } + } + columns.push({ field: `parameter_${template.pk}`, title: template_name, @@ -2026,6 +2036,7 @@ function loadParametricPartTable(table, options={}) { sortable: true, filterControl: 'input', visible: false, + formatter: fmt_func, }); } }