feat(vat): oss momskod keeps unionsordningen sales out of the momsdeklaration (#1797)

A Fortnox user with OSS sales hit the SIE import mapping step and found no
way to map OSS accounts: the momskod picker had no OSS option, 3106-style
labels ("Försäljning varor till annat EU-land, momspliktig") were suggested
as EU-varor (ruta 35), and an OSS revenue account with a sats set leaked into
ruta 05. Skatteverket: "Den försäljning som du redovisar i OSS ska du inte
redovisa i den vanliga momsdeklarationen."

- add the 'oss' revenue treatment: allowed for class 3 only, mapped to no
  ruta, default rate null (destination-country rate is not a Swedish sats);
  explicit 'oss' also overrides static BAS mappings such as 3001
- REVENUE_RUTA becomes a partial map where null = allowed but off the
  declaration, so the class gate no longer conflates "no ruta" with
  "purchase-only"
- SIE label suggestion: OSS/unionsordningen labels suggest 'oss';
  momspliktig EU-varor labels are left for review instead of ruta 35
- AccountVatTreatmentSchema derives from ACCOUNT_VAT_TREATMENTS instead of a
  second literal list
- migration widens the class-aware CHECK with 'oss' for class 3 (superset;
  NOT VALID + VALIDATE like its predecessor); pg test extended
- sv/en labels; unit tests for resolver, suggestion, declaration exclusion

Per-country VAT rates on invoices and the quarterly EUR/ECB OSS underlag
remain unbuilt (DECISIONS.md).


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

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-22 10:49:07 +02:00
committed by GitHub
co-authored by Jakob Wennberg Claude Fable 5
parent 1f7acbf144
commit 51c815254a
11 changed files with 156 additions and 12 deletions
@@ -34,6 +34,29 @@ describe('enrichAccountMappingsWithVat', () => {
})
})
it('suggests oss from an OSS label and leaves the BAS 3106 label for review', () => {
const [oss, b2c] = enrichAccountMappingsWithVat(
[
mapping('3111', 'Försäljning enl. OSS (Spanien 21%)'),
mapping('3106', 'Försäljning varor till annat EU-land, momspliktig'),
],
[],
)
expect(oss).toMatchObject({
defaultVatTreatment: 'oss',
defaultVatRate: null,
vatTreatmentSuggested: true,
vatTreatmentReviewed: false,
requiresVatTreatmentReview: true,
})
expect(b2c).toMatchObject({
defaultVatTreatment: null,
vatTreatmentSuggested: false,
vatTreatmentReviewed: false,
requiresVatTreatmentReview: true,
})
})
it('keeps an existing account treatment without asking again', () => {
const [result] = enrichAccountMappingsWithVat(
[mapping('3041', 'Försäljning tjänst 25% sv')],