Add/bokslut (#718)

* feat(arcim-migration): Briox provider with SIE-over-API import

- Briox auth via account ID + application token (no app-level
  credentials); both tokens rotate on refresh and are persisted
- New sie-fetcher pulls the general ledger as SIE through the
  provider API for Fortnox, Briox and Bjorn Lunden
- Wizard stops on a failed SIE import and surfaces the real errors
  instead of proceeding to the misleading migrate-guard message
- PROVIDER_SIE_ONLY_FORTNOX renamed to PROVIDER_SIE_NOT_SUPPORTED;
  new PROVIDER_TOKEN_INVALID for rejected provider credentials

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(bookkeeping): per-line accruals (periodisering) on invoices and supplier invoices

Defer revenue/costs per invoice line to 29xx/17xx interim accounts with
automatic monthly dissolution (nightly cron + catch-up at registration),
schedule cancellation on credit, year-end auto-detect exclusion for
already-scheduled invoices, invoice-inbox service-period extraction for
prefill, and an MCP tool to list schedules.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(bokslut): iXBRL arsredovisning generation and Bolagsverket digital filing

Generate the annual report as iXBRL from a generated taxonomy registry
(K2 element lists, taxonomy:generate/check scripts + CI guard), expose it
via the fiscal-period API, and add the bolagsverket extension for digital
submission to eget utrymme with webhook-driven status tracking
(submissions table + pg tests, lifecycle events, year-end wizard UI).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(mcp): raise origin-guard test timeout to 20s

The dynamic import pulls in the full server module; the parse alone
flirts with the 5s default under full-suite parallel load.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add new scripts and documentation for K2 AB taxonomy generation and validation

- Introduced `generate-taxonomy-registry.ts` to automate the generation of the iXBRL taxonomy concept registry from official element lists and tuple models.
- Added `validate-ixbrl.mjs` for validating generated iXBRL reports against the official taxonomy package using Arelle.
- Included new documentation files:
  - `k2-ab-arsredovisning-elementlista-2024-09-12_rev20250312_sv.xlsx`
  - `tuple-innehallsmodell-arsredovisning-k2-2024-09-12.xlsx`
  - `taxonomi-paket-2024-09-12_rev20250312.zip`

* Add tests for bookkeeping accruals dissolution and supplier invoices

- Implement tests for the POST /api/bookkeeping/accruals/[id]/dissolve route, covering success and error scenarios.
- Add tests for the DELETE /api/supplier-invoices/[id] route, including authentication checks and validation of invoice deletion conditions.
- Introduce tests for the Arcim migration provider client, ensuring token handling and error classification.
- Create tests for the Bolagsverket extension, validating submission role enforcement and environment settings.
- Add Zod schemas for Bolagsverket response payloads to ensure proper validation.
- Implement tests for MCP server's list accrual schedules, confirming registration and scope mapping.
- Add consistency tests for IXBRL document generation, ensuring duplicate facts and XML escaping are handled correctly.
- Introduce typed domain errors for accrual schedules to improve error handling in the service.
- Add tests for resolving consent with Briox token refresh concurrency, ensuring proper token management and error handling.

* fix(tests): update payload size guard comments to reflect recent changes in tool descriptions and ceiling adjustments

* fix(gitattributes): mark generated JSON files in bokslut taxonomy as linguist-generated

* feat(migrations): add backfill for invoices.journal_entry_id and fallback for next_voucher_number user_id

* feat(bokslut): enhance compliance and financial processing features with new submission details and security measures

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Mattsson
2026-06-12 16:35:30 +02:00
committed by GitHub
co-authored by Claude Fable 5
parent 8e8b63a200
commit db8983ba9e
131 changed files with 33796 additions and 340 deletions
+30 -1
View File
@@ -443,6 +443,24 @@
"label_bank_account": "Bank account",
"no_contact_info": "No contact details"
},
"accruals": {
"row_toggle": "Defer over period",
"row_toggle_aria": "Defer line {index} over a period",
"row_menu_add": "Add accrual period",
"row_menu_remove": "Remove deferral",
"panel_title": "Periodisering",
"start_label": "Period start",
"end_label": "Period end",
"account_label": "Balance account",
"remove_aria": "Remove deferral",
"preview": "{months} months × {amount}",
"preview_invalid_period": "The period end must be after its start",
"preview_min_months": "Deferral requires at least 2 calendar months",
"k2_hint": "Amounts under SEK 5,000 normally do not need to be deferred (K2).",
"validation_period": "Enter a period of at least 2 calendar months",
"incomplete_toast_title": "Incomplete deferral",
"incomplete_toast_description": "Set the period start and end (at least 2 months) or remove the deferral from the line."
},
"assets": {
"title": "Fixed assets",
"new_asset": "New asset",
@@ -2235,6 +2253,7 @@
},
"invoice_review": {
"assigned_number_prefix": "Will be assigned invoice number",
"accrual_line_info": "Accrued {from} – {to}",
"customer_type_individual": "Private individual",
"customer_type_swedish_business": "Swedish business or organization",
"customer_type_eu_business": "EU business",
@@ -2306,6 +2325,8 @@
"badge_proforma": "Proforma",
"badge_delivery_note": "Delivery note",
"badge_self_billed": "Self-billing",
"badge_accrued": "Accrued",
"accrual_line_info": "Accrued {from} – {to}",
"external_number_label": "Invoice number (customer's)",
"agreement_ref_label": "Agreement reference",
"created_at": "Created {date}",
@@ -2750,7 +2771,13 @@
"account_2647": "Calculated input VAT, domestic reverse charge",
"account_2614": "Output VAT, reverse charge 25%",
"account_2624": "Output VAT, reverse charge 12%",
"account_2634": "Output VAT, reverse charge 6%"
"account_2634": "Output VAT, reverse charge 6%",
"account_1710": "Prepaid rent",
"account_1720": "Prepaid leasing fees",
"account_1730": "Prepaid insurance premiums",
"account_1740": "Prepaid interest",
"account_1790": "Other prepaid expenses",
"review_accrual_line_info": "Accrued {from} – {to}"
},
"supplier_invoice_detail": {
"back": "Back",
@@ -2808,6 +2835,8 @@
"delivery_date_label": "Delivery date",
"ocr_reference_label": "OCR/reference",
"reverse_charge_badge": "Reverse charge",
"badge_accrued": "Accrued",
"accrual_line_info": "Accrued {from} – {to}",
"amounts_title": "Amounts",
"net_excl_vat": "Net (excl. VAT)",
"vat_label": "VAT",
+30 -1
View File
@@ -443,6 +443,24 @@
"label_bank_account": "Bankkonto",
"no_contact_info": "Inga kontaktuppgifter"
},
"accruals": {
"row_toggle": "Periodisera",
"row_toggle_aria": "Periodisera rad {index}",
"row_menu_add": "Lägg till periodisering",
"row_menu_remove": "Ta bort periodisering",
"panel_title": "Periodisering",
"start_label": "Periodens start",
"end_label": "Periodens slut",
"account_label": "Balanskonto",
"remove_aria": "Ta bort periodisering",
"preview": "{months} månader × {amount}",
"preview_invalid_period": "Periodens slut måste vara efter dess start",
"preview_min_months": "Periodisering kräver minst 2 kalendermånader",
"k2_hint": "Belopp under 5 000 kr behöver normalt inte periodiseras (K2).",
"validation_period": "Ange en period på minst 2 kalendermånader",
"incomplete_toast_title": "Ofullständig periodisering",
"incomplete_toast_description": "Ange periodens start och slut (minst 2 månader) eller ta bort periodiseringen från raden."
},
"assets": {
"title": "Anläggningstillgångar",
"new_asset": "Ny tillgång",
@@ -2235,6 +2253,7 @@
},
"invoice_review": {
"assigned_number_prefix": "Tilldelas fakturanummer",
"accrual_line_info": "Periodiseras {from} – {to}",
"customer_type_individual": "Privatperson",
"customer_type_swedish_business": "Svenskt företag eller organisation",
"customer_type_eu_business": "EU-företag",
@@ -2306,6 +2325,8 @@
"badge_proforma": "Proforma",
"badge_delivery_note": "Följesedel",
"badge_self_billed": "Självfaktura",
"badge_accrued": "Periodiserad",
"accrual_line_info": "Periodiseras {from} – {to}",
"external_number_label": "Fakturanummer (kundens)",
"agreement_ref_label": "Avtalsreferens",
"created_at": "Skapad {date}",
@@ -2750,7 +2771,13 @@
"account_2647": "Beräknad ing. moms omvänd i Sverige",
"account_2614": "Utg. moms omvänd 25%",
"account_2624": "Utg. moms omvänd 12%",
"account_2634": "Utg. moms omvänd 6%"
"account_2634": "Utg. moms omvänd 6%",
"account_1710": "Förutbetalda hyreskostnader",
"account_1720": "Förutbetalda leasingavgifter",
"account_1730": "Förutbetalda försäkringspremier",
"account_1740": "Förutbetalda räntekostnader",
"account_1790": "Övriga förutbetalda kostnader",
"review_accrual_line_info": "Periodiseras {from} – {to}"
},
"supplier_invoice_detail": {
"back": "Tillbaka",
@@ -2808,6 +2835,8 @@
"delivery_date_label": "Leveransdatum",
"ocr_reference_label": "OCR/referens",
"reverse_charge_badge": "Omvänd skattskyldighet",
"badge_accrued": "Periodiserad",
"accrual_line_info": "Periodiseras {from} – {to}",
"amounts_title": "Belopp",
"net_excl_vat": "Netto (exkl. moms)",
"vat_label": "Moms",