* feat(bokslut): IL 18 kap pooled tax depreciation with method election
Rakenskapsenlig (huvudregel 30 / kompletteringsregel 20) and restvarde 25
as a company-level annual pool separate from per-asset book depreciation.
Method election persisted with immutable snapshots and book-conformity
confirmation for rakenskapsenlig.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore(db): move tax depreciation migrations to coordinated versions
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(bokslut): keep tax depreciation view loadable when a saved election goes stale
A predecessor's changed closing value can push a saved elected deduction
above the new statutory maximum; the view now falls back to the statutory
recomputation so the snapshot is flagged stale instead of crashing.
Ratchet naive-ore-round baseline down by 3.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(bokslut): resolve tax-depreciation period selects statically
The no-phantom-columns guard counts every select it cannot resolve
toward a hard ceiling, and the PERIOD_COLUMNS join pushed the repo
4 over (364 > 360). Inline the literal column list at the four call
sites so the guard verifies these columns instead of skipping them.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(bokslut): address review findings on tax depreciation election
- DepreciationPanel: gate the saving flag on a dedicated save sequence
so a successful save (which refreshes the view and bumps the request
version) no longer leaves the card permanently busy
- computeTaxDepreciation: refuse kompletteringsregel_20 with a positive
basis and no acquisition cohorts instead of degenerating to a full
write-off the cohort evidence does not support (IL 18 kap. 17 §)
- migration 227000: judge the asset-method guards on NEW.disposed_at so
reversing a disposal cannot reactivate a grandfathered non-linear row
- migration 227200: require snapshot column completeness in the CHECK;
SQL NULL semantics let partially populated snapshots pass the pure
arithmetic comparisons
- depreciation route: use the string issue code 'custom' like the rest
of the codebase instead of the Zod 3 compat enum
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>