From 891c4fef6a3a7c298fffe82634ee932e9054f2ee Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 13 Mar 2024 16:02:40 +1100 Subject: [PATCH] ParametricPartTable Updates (#6692) * Add parameter units to ParametricPartTable * Fix conversion aliases --- InvenTree/InvenTree/conversion.py | 6 +++--- src/frontend/src/tables/part/ParametricPartTable.tsx | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/InvenTree/InvenTree/conversion.py b/InvenTree/InvenTree/conversion.py index af6ba9f872..c02fd7a561 100644 --- a/InvenTree/InvenTree/conversion.py +++ b/InvenTree/InvenTree/conversion.py @@ -39,9 +39,9 @@ def reload_unit_registry(): reg = pint.UnitRegistry(autoconvert_offset_to_baseunit=True) # Aliases for temperature units - reg.define('@alias degC = celsius = Celsius') - reg.define('@alias degF = fahrenheit = Fahrenheit') - reg.define('@alias degK = kelvin = Kelvin') + reg.define('@alias degC = Celsius') + reg.define('@alias degF = Fahrenheit') + reg.define('@alias degK = Kelvin') # Define some "standard" additional units reg.define('piece = 1') diff --git a/src/frontend/src/tables/part/ParametricPartTable.tsx b/src/frontend/src/tables/part/ParametricPartTable.tsx index c655f351b2..1749033972 100644 --- a/src/frontend/src/tables/part/ParametricPartTable.tsx +++ b/src/frontend/src/tables/part/ParametricPartTable.tsx @@ -43,9 +43,15 @@ export default function ParametricPartTable({ let data = categoryParmeters.data ?? []; return data.map((template: any) => { + let title = template.name; + + if (template.units) { + title += ` [${template.units}]`; + } + return { accessor: `parameter_${template.pk}`, - title: template.name, + title: title, sortable: true, render: (record: any) => { // Find matching template parameter