feat(accounting): bill editor VAT dropdown + GET returns vat_code snapshot

Slice 2 + 1b:
- Bill editor: VAT-rate field → VatRateSelect dropdown (mirrors the quote
  editor); snapshots vatCode on create + carries it from a source quote.
- getQuoteById + the invoice serializer now return vat_code, so re-editing a
  saved document preserves the snapshot instead of falling back to the
  rate→code map. Payload types (quotes + bills) carry vatCode.

72 tests pass; build green.
This commit is contained in:
Luca
2026-06-16 00:20:59 +02:00
parent 6e1924bae8
commit 2479d87afc
4 changed files with 18 additions and 2 deletions
+2
View File
@@ -1780,6 +1780,8 @@ async function buildInvoiceRenderContext(invoice, lineItems) {
totals: {
netAmountMinor: invoice.net_amount_minor,
vatRate: invoice.vat_rate,
// Migration 130 — VAT-code snapshot (so re-editing preserves it).
vatCode: invoice.vat_code ?? null,
vatAmountMinor: invoice.vat_amount_minor,
shippingAmountMinor: invoice.shipping_amount_minor,
totalAmountMinor: invoice.total_amount_minor,