fix(collection-confirm): show the stock line's cost on the card

Stock rows on Collection Confirm were built without cost_price, so the
Cost column was blank (card total R0) and the AI price tick red ("no
cost") on every stock line, even when the line had a cost (e.g. all ten
lines of PO26100702STK after the B&R invoice was checked).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Dave 2026-10-20 07:35:25 +02:00
parent 9a28e99520
commit 70ee567215
2 changed files with 5 additions and 0 deletions

View file

@ -173,6 +173,8 @@ describe("listCollectedItems", () => {
expect(row.qty_collected).toBe(50);
expect(row.order_qty).toBe(50);
expect(row.quantity).toBe(50);
// The line's own cost: the Cost column and the AI price tick read it.
expect(row.cost_price).toBe(1.5);
expect(row.item_status).toBe("collected");
expect(row.stock_line_status).toBe("collected");
expect(row.assigned_at).toBe("2026-08-01T10:00:00.000Z");

View file

@ -405,6 +405,9 @@ export async function listCollectedItems(): Promise<ConfirmRow[]> {
qty_collected: s.quantity_received ?? 0,
order_qty: s.quantity,
quantity: s.quantity,
// Was missing: the Cost column was blank and the AI price tick red
// ("no cost") on every stock line, though the line has a cost.
cost_price: typeof s.cost_price === "number" ? s.cost_price : null,
item_status: s.status ?? undefined,
sku: s.expand?.stock_item?.sku,
line_sku: typeof s.sku === "string" ? s.sku.trim() : "",