From 2a1e0cf0a4e84fa0b9d5f453965f4593f4d506e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20M=C3=A1rton?= Date: Tue, 17 Nov 2026 13:20:46 +0100 Subject: [PATCH] Show location description in the Stock Item/Stock Details Location field (#13297) * Show location description in the Stock Item/Stock Details Location field * Display full stock location path as a hover tooltip in the Stock Item/Stock Details/Location view * Display category description next to the category name if set: - Part category details view parent category - Part details view category Display location description next to the location name if set: - Part category details view Default location and Parent default location - Part details view Default and Category default location - Build orders Source and Destination location - Purchaseorder Destination location - Stock location parent location --- src/frontend/src/components/details/Details.tsx | 12 +++++++++--- .../src/pages/build/BuildOrderDetailsPanel.tsx | 8 ++++++++ .../src/pages/part/PartCategoryDetailsPanel.tsx | 12 ++++++++++++ src/frontend/src/pages/part/PartDetailsPanel.tsx | 12 ++++++++++++ .../pages/purchasing/PurchaseOrderDetailsPanel.tsx | 4 ++++ src/frontend/src/pages/stock/StockDetailsPanel.tsx | 5 +++++ .../src/pages/stock/StockLocationDetailsPanel.tsx | 4 ++++ 7 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/components/details/Details.tsx b/src/frontend/src/components/details/Details.tsx index 5774e5a837..b9e6a922ab 100644 --- a/src/frontend/src/components/details/Details.tsx +++ b/src/frontend/src/components/details/Details.tsx @@ -10,7 +10,8 @@ import { Skeleton, Stack, Table, - Text + Text, + Tooltip } from '@mantine/core'; import { useQuery } from '@tanstack/react-query'; import { getValueAtPath } from 'mantine-datatable'; @@ -39,6 +40,7 @@ export type DetailsField = { icon?: keyof InvenTreeIconType; name: string; label?: string; + tooltip?: string; badge?: BadgeType; copy?: boolean; value_formatter?: () => ValueFormatterReturn; @@ -441,7 +443,11 @@ function TableAnchorValue(props: Readonly) { } return ( - <> + {make_link ? ( {value} @@ -449,7 +455,7 @@ function TableAnchorValue(props: Readonly) { ) : ( {value} )} - + ); } diff --git a/src/frontend/src/pages/build/BuildOrderDetailsPanel.tsx b/src/frontend/src/pages/build/BuildOrderDetailsPanel.tsx index f8ccf92bde..2553f4b381 100644 --- a/src/frontend/src/pages/build/BuildOrderDetailsPanel.tsx +++ b/src/frontend/src/pages/build/BuildOrderDetailsPanel.tsx @@ -178,6 +178,10 @@ export function BuildOrderDetailsPanel({ icon: 'location', hidden: !instance?.take_from, model: ModelType.stocklocation, + model_formatter: (location: any) => + location?.description + ? `${location.name} - ${location.description}` + : location?.name, label: t`Source Location`, backup_value: t`Any location` }, @@ -186,6 +190,10 @@ export function BuildOrderDetailsPanel({ name: 'destination', icon: 'location', model: ModelType.stocklocation, + model_formatter: (location: any) => + location?.description + ? `${location.name} - ${location.description}` + : location?.name, label: t`Destination Location`, hidden: !instance?.destination }, diff --git a/src/frontend/src/pages/part/PartCategoryDetailsPanel.tsx b/src/frontend/src/pages/part/PartCategoryDetailsPanel.tsx index d8cb7f881a..354a6245ab 100644 --- a/src/frontend/src/pages/part/PartCategoryDetailsPanel.tsx +++ b/src/frontend/src/pages/part/PartCategoryDetailsPanel.tsx @@ -49,6 +49,10 @@ export function PartCategoryDetailsPanel({ icon: 'location', label: t`Parent Category`, model: ModelType.partcategory, + model_formatter: (category: any) => + category?.description + ? `${category.name} - ${category.description}` + : category?.name, hidden: !instance?.parent }, { @@ -88,6 +92,10 @@ export function PartCategoryDetailsPanel({ name: 'parent_default_location', label: t`Parent default location`, model: ModelType.stocklocation, + model_formatter: (location: any) => + location?.description + ? `${location.name} - ${location.description}` + : location?.name, hidden: !instance?.parent_default_location || !!instance?.default_location }, @@ -96,6 +104,10 @@ export function PartCategoryDetailsPanel({ name: 'default_location', label: t`Default location`, model: ModelType.stocklocation, + model_formatter: (location: any) => + location?.description + ? `${location.name} - ${location.description}` + : location?.name, hidden: !instance?.default_location } ], diff --git a/src/frontend/src/pages/part/PartDetailsPanel.tsx b/src/frontend/src/pages/part/PartDetailsPanel.tsx index 64cea50a98..34474a553d 100644 --- a/src/frontend/src/pages/part/PartDetailsPanel.tsx +++ b/src/frontend/src/pages/part/PartDetailsPanel.tsx @@ -112,6 +112,10 @@ export function PartDetailsPanel({ type: 'link', name: 'category', label: t`Category`, + model_formatter: (category: any) => + category?.description + ? `${category.name} - ${category.description}` + : category?.name, model: ModelType.partcategory }, { @@ -119,6 +123,10 @@ export function PartDetailsPanel({ name: 'default_location', label: t`Default Location`, model: ModelType.stocklocation, + model_formatter: (default_location: any) => + default_location?.description + ? `${default_location.name} - ${default_location.description}` + : default_location?.name, hidden: !instance?.default_location }, { @@ -126,6 +134,10 @@ export function PartDetailsPanel({ name: 'category_default_location', label: t`Category Default Location`, model: ModelType.stocklocation, + model_formatter: (location: any) => + location?.description + ? `${location.name} - ${location.description}` + : location?.name, hidden: instance?.default_location || !instance?.category_default_location }, { diff --git a/src/frontend/src/pages/purchasing/PurchaseOrderDetailsPanel.tsx b/src/frontend/src/pages/purchasing/PurchaseOrderDetailsPanel.tsx index 7b640d0f1a..37e45b0f36 100644 --- a/src/frontend/src/pages/purchasing/PurchaseOrderDetailsPanel.tsx +++ b/src/frontend/src/pages/purchasing/PurchaseOrderDetailsPanel.tsx @@ -100,6 +100,10 @@ export function PurchaseOrderDetailsPanel({ link: true, name: 'destination', label: t`Destination`, + model_formatter: (location: any) => + location?.description + ? `${location.name} - ${location.description}` + : location?.name, hidden: !instance?.destination }, { diff --git a/src/frontend/src/pages/stock/StockDetailsPanel.tsx b/src/frontend/src/pages/stock/StockDetailsPanel.tsx index 00c23cc8f1..f9df32bb5e 100644 --- a/src/frontend/src/pages/stock/StockDetailsPanel.tsx +++ b/src/frontend/src/pages/stock/StockDetailsPanel.tsx @@ -236,6 +236,11 @@ export function StockDetailsPanel({ name: 'location', label: t`Location`, model: ModelType.stocklocation, + tooltip: instance?.location_detail?.pathstring, + model_formatter: (location: any) => + location?.description + ? `${location.name} - ${location.description}` + : location?.name, hidden: !instance?.location }, { diff --git a/src/frontend/src/pages/stock/StockLocationDetailsPanel.tsx b/src/frontend/src/pages/stock/StockLocationDetailsPanel.tsx index 5f09fa9e45..8907d5af35 100644 --- a/src/frontend/src/pages/stock/StockLocationDetailsPanel.tsx +++ b/src/frontend/src/pages/stock/StockLocationDetailsPanel.tsx @@ -48,6 +48,10 @@ export function StockLocationDetailsPanel({ icon: 'location', label: t`Parent Location`, model: ModelType.stocklocation, + model_formatter: (location: any) => + location?.description + ? `${location.name} - ${location.description}` + : location?.name, hidden: !instance?.parent } ];