fix(bookkeeping): name 1249/1259/1269 after their BAS 2026 free heads, drop retired 12xx sub-accounts (#2419)
* fix(bookkeeping): name 1249/1259/1269 after their BAS 2026 free heads, drop retired 12xx sub-accounts A sole trader booking a tractor activated 1240 and 1249 from the account picker and got a machinery head labelled "(Fritt konto för Maskiner och andra tekniska anläggningar)" next to a contra account labelled "Ack. avskrivningar på bilar och andra transportmedel". Why it occurred: BAS 2026 restructured kontogrupp 12. Bilar and datorer moved under 1210 (för produktion) and 1220 (ej för produktion), and 1230/1240/1250/1260 became free heads. The catalog in lib/bookkeeping/bas-data/ followed for the heads (#463) but kept seven sub-accounts the official chart no longer has (1241, 1242, 1249, 1251, 1259, 1261, 1269) with their pre-2026 names. Every picker activation of a 12xx contra account therefore produced the contradiction; prod carries the 1240/1249 pair in 173 charts, 1250/1259 in 153 and 1260/1269 in 78. What was removed instead of patched: 1241, 1242, 1251 and 1261 leave the catalog entirely (bas.se BAS 2026 v2 has no such accounts; the SIE mapper already self-maps unknown sub-accounts by number). 1249/1259/1269 stay because the asset module's vehicle and computer defaults and 31 live assets in prod depend on them; they are renamed after their heads so the pair reads as one thing. Why this and not the proposal: the reporter asked for 1249 to be renamed to "ack. avskr. maskiner", which fixes one number and leaves 1259/1269 and the four retired asset accounts contradicting their heads. Dropping 1249/1259/1269 and moving the asset defaults to BAS 2026 (1226/1224 on 1229) is the right long-term shape but changes what a new vehicle or computer asset books to; that decision is the founder's and is tracked in #2414. The migration renames a contra account only when its name is byte-identical to one of the two catalog literals AND the company's head carries the BAS 2026 free label, so old-BAS imports (1240 "Bilar och andra transportmedel") and every user rename stay untouched. Applied and pg-tested on staging. Fixes #2413 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NXSuVejFCvRDyNXF1otEPd * fix(bookkeeping): skip 12xx contra accounts with journal lines in the label backfill Skeptic refutation: lib/import/account-sync.ts creates missing accounts with the catalog name when the SIE #KONTO names are not carried, so an old-BAS vehicle chart can hold the exact free-head + bilar-contra pair with years of depreciation booked on 1249 (8 such charts in prod). The backfill now also requires that the contra account has no journal lines: a label with history is the user's to change. Migration re-issued under a fresh version, applied and pg-tested on staging. Refs #2413 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NXSuVejFCvRDyNXF1otEPd * fix(bookkeeping): lock journal_entry_lines while the 12xx label backfill checks history CodeRabbit (Major): under READ COMMITTED a posting could commit between the NOT EXISTS history check and the rename. A SHARE lock on journal_entry_lines for the migration transaction makes the two atomic; inserts wait milliseconds, reads are unaffected. Migration re-issued under a fresh version, applied and pg-tested on staging. Refs #2413 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NXSuVejFCvRDyNXF1otEPd --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
2303f75a7b
commit
59d5b7b366
@@ -697,36 +697,14 @@ export const CLASS_1_ACCOUNTS: BASReferenceAccount[] = [
|
||||
sru_code: '7202',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '1241',
|
||||
account_name: 'Personbilar',
|
||||
account_class: 1,
|
||||
account_group: '12',
|
||||
account_type: 'asset',
|
||||
normal_balance: 'debit',
|
||||
description: 'Personbilar',
|
||||
sru_code: '7202',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '1242',
|
||||
account_name: 'Lastbilar och andra transportmedel',
|
||||
account_class: 1,
|
||||
account_group: '12',
|
||||
account_type: 'asset',
|
||||
normal_balance: 'debit',
|
||||
description: 'Lastbilar och andra transportmedel',
|
||||
sru_code: '7202',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '1249',
|
||||
account_name: 'Ack. avskrivningar på bilar och andra transportmedel',
|
||||
account_name: 'Ackumulerade avskrivningar (fritt konto för Maskiner och andra tekniska anläggningar)',
|
||||
account_class: 1,
|
||||
account_group: '12',
|
||||
account_type: 'asset',
|
||||
normal_balance: 'credit',
|
||||
description: 'Ackumulerade avskrivningar på bilar och andra transportmedel (kontra-tillgång)',
|
||||
description: 'Ackumulerade avskrivningar på det fria maskinkontot 1240 (kontra-tillgång). BAS 2026 har inga bilkonton i 124x; bilar är 1216 eller 1226.',
|
||||
sru_code: '7202',
|
||||
k2_excluded: false,
|
||||
},
|
||||
@@ -741,25 +719,14 @@ export const CLASS_1_ACCOUNTS: BASReferenceAccount[] = [
|
||||
sru_code: '7215',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '1251',
|
||||
account_name: 'Inventarier',
|
||||
account_class: 1,
|
||||
account_group: '12',
|
||||
account_type: 'asset',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inventarier',
|
||||
sru_code: '7215',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '1259',
|
||||
account_name: 'Ack. avskrivningar på inventarier och verktyg',
|
||||
account_name: 'Ackumulerade avskrivningar (fritt konto för Inventarier, verktyg och installationer)',
|
||||
account_class: 1,
|
||||
account_group: '12',
|
||||
account_type: 'asset',
|
||||
normal_balance: 'credit',
|
||||
description: 'Ackumulerade avskrivningar på inventarier och verktyg (kontra-tillgång)',
|
||||
description: 'Ackumulerade avskrivningar på det fria inventariekontot 1250 (kontra-tillgång). BAS 2026 har inga datorkonton i 125x; datorer är 1214 eller 1224.',
|
||||
sru_code: '7215',
|
||||
k2_excluded: false,
|
||||
},
|
||||
@@ -774,25 +741,14 @@ export const CLASS_1_ACCOUNTS: BASReferenceAccount[] = [
|
||||
sru_code: '7215',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '1261',
|
||||
account_name: 'Datorer, bärbara',
|
||||
account_class: 1,
|
||||
account_group: '12',
|
||||
account_type: 'asset',
|
||||
normal_balance: 'debit',
|
||||
description: 'Datorer, bärbara',
|
||||
sru_code: '7215',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '1269',
|
||||
account_name: 'Ack. avskrivningar på datorer',
|
||||
account_name: 'Ackumulerade avskrivningar (fritt konto för Inventarier, verktyg och installationer)',
|
||||
account_class: 1,
|
||||
account_group: '12',
|
||||
account_type: 'asset',
|
||||
normal_balance: 'credit',
|
||||
description: 'Ackumulerade avskrivningar på datorer (kontra-tillgång)',
|
||||
description: 'Ackumulerade avskrivningar på det fria inventariekontot 1260 (kontra-tillgång). BAS 2026 har inga leasingkonton i 126x; leasade tillgångar är 1217 eller 1227.',
|
||||
sru_code: '7215',
|
||||
k2_excluded: false,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user