feat(supplier-invoices): "Vem betalade?" control replaces the paid privately switch and books an open utlägg (#2362)

The supplier-invoice form asks who paid with the same control as the
Underlag pane (Företaget / Jag, privat / En anställd / Ingen ännu) instead
of its own switch under Förval. A person paying is an utlägg: the route
hands the invoice to registerExpenseClaim with the invoice's kontering as
the claim's lines, so the verifikat and the expense_claims row come from
the same writer as the Underlag pane, the person shows up under "Betala ut
utlägg" on Hem and the bank matcher closes the debt. Employees book on
2820 with employee_id; the owner's blank name falls back to the shared
label so Hem groups one person.

Also routes a person-paid inbox document through the core route with
inbox_item_id: the extension's convert endpoint never read
paid_with_private_funds, so the old switch was silently dropped whenever
a receipt was attached. The second entry generator, the Förval switch,
the outline "Registrera & markera som betald" button and the duplicated
owner/employee picker are removed; PayerChoiceSelect and the claimant
fields move to components/expenses so core and the extension share them.

Closes #2332


Claude-Session: https://claude.ai/code/session_01LvMaHcTnwAfxzgYD1fGYX1

Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-09-06 21:04:17 +02:00
committed by GitHub
co-authored by Jakob Wennberg Claude Fable 5.1
parent 6776cb4fc6
commit ebbe50c0f3
20 changed files with 1318 additions and 575 deletions
+11
View File
@@ -1343,6 +1343,17 @@ export const CreateSupplierInvoiceSchema = z.object({
// Per-invoice öresavrundning toggle (display-only). Omitted → stored as null (off).
ore_rounding: z.boolean().optional(),
paid_with_private_funds: z.boolean().optional(),
// For paid_with_private_funds: who paid. An employee (2820) by id, or the
// owner by name (2893 in an AB, 2018 in an enskild firma); an omitted name
// falls back to the shared owner label so Hem groups the owner as one
// person. Both are ignored unless paid_with_private_funds is true.
employee_id: uuid.optional().nullable(),
claimant_name: z.string().trim().max(200).optional(),
// For paid_with_private_funds: the invoice-inbox item whose document is the
// underlag. The route takes the document from the item and settles the item
// itself, so a privately paid inbox document never goes through the
// extension's convert endpoint (which registers on 2440 only).
inbox_item_id: uuid.optional().nullable(),
// For paid_with_private_funds: the date the owner paid out-of-pocket.
// Defaults to invoice_date (common for kvitto where the two coincide).
payment_date: isoDate.optional(),