Files
accounted/lib
Jakob Wennberg 1163fd3bee fix(invoices): drop UTKAST banner from sent/archived PDFs (#495)
The "UTKAST – inte en giltig faktura" banner in pdf-template.tsx fires
whenever `invoice.status === 'draft'`. All four send-equivalent code
paths render the PDF while the in-memory invoice still reads 'draft',
so the customer's email attachment and the archived underlag are both
stamped as not-a-valid-faktura.

- /api/invoices/[id]/send: status flip happens after email delivery
  (kept that way so a provider failure leaves the row in draft); render
  with `{ ...invoice, status: 'sent' }` instead of mutating order.
- /api/invoices/[id]/mark-sent: DB flip happens before render but the
  in-memory copy is never re-fetched.
- /api/v1/companies/.../invoices/[id]/send: same shape as the internal
  send route; extend the existing `renderableInvoice` override.
- lib/pending-operations/commit.ts (MCP send path): same shape.

The banner condition itself is unchanged — the genuine draft preview
(`/api/invoices/[id]/pdf`) still surfaces the watermark correctly.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 10:43:14 +02:00
..
2026-05-06 11:12:02 +02:00
2026-05-15 00:49:59 +02:00
2026-03-21 00:47:54 +01:00
2026-05-05 09:53:37 +02:00
2026-05-06 14:08:38 +02:00
2026-02-24 16:06:36 +01:00
2026-05-05 09:53:37 +02:00
2026-05-13 00:26:04 +02:00
2026-05-14 01:10:44 +02:00
2026-05-06 11:12:02 +02:00
2026-04-22 18:14:01 +02:00
2026-05-12 01:10:01 +02:00
2026-05-14 01:10:44 +02:00
2026-04-15 11:17:39 +02:00
2026-05-13 15:17:32 +02:00
2026-05-13 00:26:04 +02:00
2026-05-06 11:12:02 +02:00
2026-05-08 15:42:06 +02:00
2026-04-29 16:32:26 +02:00
2026-05-13 00:26:04 +02:00