fix(invoices): make self-billed invoices creditable and their dates visible (#1827)

A self-billed invoice has invoice_number null by design (the counterparty's
number lives in external_invoice_number), which broke the whole credit flow:
the confirm input was disabled and compared against null, the API minted the
literal number 'KR-null', and the credit-note PDF dropped its ML 17 kap 22
reference to the original. The editor also hid fakturadatum inside the
collapsed Forval panel, so self-billed invoices silently registered with
today's date and, being immutable, could not be corrected.

- creditConfirmNumber() falls back to external_invoice_number; the credit
  page uses it for reason default, subtitle, original row, preview, confirm
  label/placeholder/disabled, mismatch check and submit gate
- createCreditNote numbers 'KR-<external>' for self-billed originals and
  refuses with typed 400 INVOICE_CREDIT_NO_NUMBER when no number exists
- mark-sent and send select external_invoice_number and fall back for the
  credit-note PDF's reference to the original
- the Forval chip line now shows the invoice date in every mode, and
  self-billed mode renders fakturadatum + mottagningsdatum uncollapsed as
  transcription fields next to the external number

Fixes #1820


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

Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-08-24 13:18:57 +02:00
committed by GitHub
co-authored by Jakob Wennberg Claude Fable 5
parent 21c63b8b12
commit 78525bd391
15 changed files with 295 additions and 54 deletions
+1
View File
@@ -3655,6 +3655,7 @@
"remove_row_aria_named": "Remove line: {description}",
"validation_price_invalid": "Enter a unit price",
"chip_currency": "Currency {currency}",
"chip_invoice_date": "Invoice date {date}",
"chip_due_days": "Due in {days} days ({date})",
"chip_due_date": "Due {date}",
"chip_received": "Received {date}",
+1
View File
@@ -3655,6 +3655,7 @@
"remove_row_aria_named": "Ta bort rad: {description}",
"validation_price_invalid": "Ange ett à-pris",
"chip_currency": "Valuta {currency}",
"chip_invoice_date": "Fakturadatum {date}",
"chip_due_days": "Förfaller {days} dagar ({date})",
"chip_due_date": "Förfaller {date}",
"chip_received": "Mottagen {date}",