From 2cb6491654c713b0ceaa9151d02421ab41c58439 Mon Sep 17 00:00:00 2001 From: SJCoetz Date: Fri, 31 Jul 2026 14:20:17 +0200 Subject: [PATCH] feat(stock-orders): show SKU in line table on stock-order detail Adds a 'SKU' column between Description and Ordered in the lines table on /stock-orders/[id]. The column reads from line.expand.stock_item.sku (the relation was already accessible via the type, but the page was not expanding it on the fetch). Falls back to an em-dash when expand is missing (e.g. an item whose stock_item was deleted) so the row never renders an empty cell. Co-Authored-By: Claude Co-authored-by: Orca --- src/app/(app)/stock-orders/[id]/page.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/(app)/stock-orders/[id]/page.tsx b/src/app/(app)/stock-orders/[id]/page.tsx index 0fe9e1e..2a5229c 100644 --- a/src/app/(app)/stock-orders/[id]/page.tsx +++ b/src/app/(app)/stock-orders/[id]/page.tsx @@ -144,6 +144,10 @@ export default function StockOrderDetailPage({ .getFullList({ filter: `purchase = "${id}"`, sort: "created", + // Expand the related stock_item so the row can show the + // SKU next to the description. The relation is a string + // ID otherwise; the page only reads `stock_item.sku`. + expand: "stock_item", }), ]); setPurchase(purchaseRes); @@ -540,6 +544,7 @@ export default function StockOrderDetailPage({ Description + SKU Ordered Cost / unit Received @@ -550,7 +555,7 @@ export default function StockOrderDetailPage({ {items.length === 0 ? ( No lines on this stock order. @@ -573,6 +578,9 @@ export default function StockOrderDetailPage({ )} + + {line.expand?.stock_item?.sku ?? "—"} + {ordered}