Primary-source check against bas.se (BAS 2026 v2): the official kontoplan has no account 2012; the enskild firma equity block is 2010, 2011, 2013, 2017, 2018, 2019. 2012 'Avräkning för skatter och avgifter' is a program convention (Visma, Bokio, Björn Lundén), not standard BAS, and a non-standard account in BAS_REFERENCE leaks via the backfill into charts, SIE export and SRU filing. - remove 2012 from class-2-equity-liabilities.ts, with a tombstone comment - migration retargets 'Preliminär F-skatt (EF)' lines 2012 -> 2013 (system row plus any clones still carrying the seeded shape) - pin 2012's absence in bas-ef-equity-accounts.test.ts (2113 precedent) - correct the swedish-year-end-closing references that motivated #1388, regenerate atom seed migration Companies whose charts already got 2012 backfilled keep it: existing history stays valid; only future template use books 2013. Closes #1409 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:
co-authored by
Jakob Wennberg
Claude Fable 5
parent
3ff12faa77
commit
fe1ff8649b
@@ -2,37 +2,40 @@ import { describe, it, expect } from 'vitest'
|
||||
import { getBASReference } from '@/lib/bookkeeping/bas-reference'
|
||||
|
||||
/**
|
||||
* The enskild firma equity block must be complete.
|
||||
* The enskild firma equity block must match the official BAS kontoplan.
|
||||
*
|
||||
* 2012 was missing from the reference, which is not cosmetic:
|
||||
* `lib/bookkeeping/account-backfill.ts` only seeds accounts that appear in
|
||||
* BAS_REFERENCE, so an account absent from it can never be added to a company's
|
||||
* chart on demand. Any entry touching 2012 failed with AccountsNotInChartError,
|
||||
* which is exactly what the "Preliminär F-skatt (EF)" template did.
|
||||
*
|
||||
* The gap was found by the pack validator asserting that every account a
|
||||
* template references exists in BAS 2026.
|
||||
* 2012 "Avräkning för skatter och avgifter" was added in #1388 on the strength
|
||||
* of the swedish-year-end-closing skill alone. The primary-source check
|
||||
* (#1409, bas.se BAS 2026 v2) shows the official chart has no 2012: the block
|
||||
* runs 2010, 2011, 2013, 2017, 2018, 2019, and the official "Avräkning för
|
||||
* skatter och avgifter (skattekonto)" accounts are 1630/1640 (asset) and 2850
|
||||
* (liability). 2012 is a program convention (Visma, Bokio, Björn Lundén), not
|
||||
* standard BAS. A non-standard account in BAS_REFERENCE leaks into every chart
|
||||
* the backfill seeds, and from there into SIE export and SRU filing, so the
|
||||
* reference must not carry it. Owner taxes paid by the firm are an eget uttag
|
||||
* on 2013, which is what the "Preliminär F-skatt (EF)" template books since
|
||||
* migration 20260810120000.
|
||||
*/
|
||||
describe('enskild firma equity accounts (20xx)', () => {
|
||||
it('has no hole in the 2010-2013 run', () => {
|
||||
for (const account of ['2010', '2011', '2012', '2013']) {
|
||||
it('carries exactly the official BAS block for delägare 1', () => {
|
||||
for (const account of ['2010', '2011', '2013', '2017', '2018', '2019']) {
|
||||
expect(getBASReference(account), `${account} missing from BAS reference`).toBeDefined()
|
||||
}
|
||||
})
|
||||
|
||||
it('2012 is the owner-tax equity account, distinct from the 1630 skattekonto asset', () => {
|
||||
const equity = getBASReference('2012')
|
||||
const skattekonto = getBASReference('1630')
|
||||
|
||||
expect(equity?.account_type).toBe('equity')
|
||||
expect(equity?.normal_balance).toBe('debit')
|
||||
// Both are called "avräkning", which is precisely why they get confused.
|
||||
expect(skattekonto?.account_type).toBe('asset')
|
||||
expect(equity?.account_number).not.toBe(skattekonto?.account_number)
|
||||
it('does not carry 2012: not in official BAS, verified against bas.se in #1409', () => {
|
||||
// Pinned like 2113 below: prevents a well-meaning "fix" that re-adds the
|
||||
// program-convention account instead of keeping the reference official.
|
||||
expect(getBASReference('2012')).toBeUndefined()
|
||||
})
|
||||
|
||||
it('shares the equity SRU code with its siblings, since they all net into 2010', () => {
|
||||
const siblings = ['2011', '2012', '2013', '2018'].map((a) => getBASReference(a)?.sru_code)
|
||||
it('keeps the skattekonto asset account the template settles against', () => {
|
||||
const skattekonto = getBASReference('1630')
|
||||
expect(skattekonto?.account_type).toBe('asset')
|
||||
})
|
||||
|
||||
it('shares the equity SRU code across the sub-accounts, since they all net into 2010', () => {
|
||||
const siblings = ['2011', '2013', '2018'].map((a) => getBASReference(a)?.sru_code)
|
||||
expect(new Set(siblings).size).toBe(1)
|
||||
expect(siblings[0]).toBe(getBASReference('2010')?.sru_code)
|
||||
})
|
||||
|
||||
@@ -23,21 +23,11 @@ export const CLASS_2_ACCOUNTS: BASReferenceAccount[] = [
|
||||
sru_code: '7221',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '2012',
|
||||
account_name: 'Avräkning för skatter och avgifter',
|
||||
account_class: 2,
|
||||
account_group: '20',
|
||||
account_type: 'equity',
|
||||
normal_balance: 'debit',
|
||||
description:
|
||||
'Enskild firma: ägarens egna skatter och avgifter (t.ex. preliminär F-skatt) som betalas ' +
|
||||
'av företaget. Ett eget uttag, inte en företagskostnad. Nollas mot 2010 Eget kapital vid ' +
|
||||
'nytt räkenskapsår. Ska inte förväxlas med 1630 Avräkning för skatter och avgifter ' +
|
||||
'(skattekonto), som är tillgångssidans saldo mot Skatteverket.',
|
||||
sru_code: '7221',
|
||||
k2_excluded: false,
|
||||
},
|
||||
// 2012 is deliberately absent: the official BAS kontoplan (bas.se, BAS 2026 v2)
|
||||
// has no 2012; the enskild firma equity block runs 2010, 2011, 2013, 2017,
|
||||
// 2018, 2019. "Avräkning för skatter och avgifter" as 2012 is a program
|
||||
// convention (Visma, Bokio, Björn Lundén), not standard BAS; owner taxes are
|
||||
// booked as eget uttag on 2013. Verified against the primary source in #1409.
|
||||
{
|
||||
account_number: '2013',
|
||||
account_name: 'Övriga egna uttag',
|
||||
|
||||
@@ -54,6 +54,15 @@ const INTENTIONAL_DIVERGENCES: Record<string, Divergence> = {
|
||||
seededName: 'Periodiseringsfond återföring (AB)',
|
||||
reason: 'Same 2113 fix as periodiseringsfond-avsattning-ab.',
|
||||
},
|
||||
'preliminar-f-skatt-ef': {
|
||||
seededName: 'Preliminär F-skatt (EF)',
|
||||
reason:
|
||||
'Seeded version debited 2012 "Avräkning för skatter och avgifter". The primary-source ' +
|
||||
'check in #1409 (bas.se BAS 2026 v2) shows official BAS has no 2012: the EF equity block ' +
|
||||
'is 2010/2011/2013/2017/2018/2019, and 2012 is a Visma/Bokio/BL program convention. Owner ' +
|
||||
'taxes paid by the firm are an eget uttag, so the template now debits 2013 Övriga egna ' +
|
||||
'uttag; migration 20260810120000 retargets the seeded rows the same way.',
|
||||
},
|
||||
'representation-avdragsgill-25-moms': {
|
||||
seededName: 'Representation (avdragsgill, 25% moms)',
|
||||
reason:
|
||||
|
||||
Reference in New Issue
Block a user