Skip to content

Preserve result accounts during year-end closing - #141

Merged
perNyfelt merged 5 commits into
mainfrom
fix/130-year-end-result-transfer
Nov 14, 2026
Merged

perNyfelt merged 5 commits into
mainfrom
fix/130-year-end-result-transfer

Conversation

@perNyfelt

@perNyfelt perNyfelt commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Year-end closing transfers only the remaining result through 8999 against the selected equity account, preserving individual income and expense balances. Fully transferred results produce no additional closing voucher. Income statements and next-year comparisons retain the year's actual figures, and 8999 is excluded regardless of its configured subgroup.

The dialog and MCP preview separate operating income/expenses (excluding 8999), the year's actual net_result, transferred_result already booked through 8999, and remaining_result. Both preview and closing responses expose result_accounts_with_balance_count; the former result_account_count field is removed. Closing responses retain the preview figures, with remaining_result describing the amount posted by that operation.

Closing-account defaults live on LegalForm.defaultResultAccount: 2099 for AB, 2019 for EF/HB/KB, with an unset legal form retaining the AB fallback. The dialog resolves its default in the preview worker; errors are displayed with closing disabled. MCP descriptions derive the defaults from the enum, and preview tokens bind to the resolved account. Explicit overrides remain supported.

SIE4 export includes nonzero natural-sign #RES records reconciling with the exported vouchers. Closing metadata records the actual result transfer; only balance-sheet accounts carry forward. The manual explains that an HB/KB result initially lands on partner 1's 2019 and requires manual allocation to the other partners' result or capital accounts.

Regression coverage includes profits/losses, partial/full/excessive prior transfers, actual preview totals and dialog labels, misgrouped 8999 accounts, report comparisons, SIE amounts and reversed activity, legal-form defaults, overrides, and MCP token invalidation. Live Swing checks also verified failed-preview handling. Test teardown restores the home override in finally.

No schema migration or historical ledger rewrite. The correction plan documents the separate audited workflow needed for previously closed years. Automatic new-year equity reallocations remain separate work.

Validation: ./gradlew spotlessApply, ./gradlew codenarcMain, ./gradlew codenarcTest, and ./gradlew build passed. Full suite: 872 tests, 0 failures, 11 skipped.

Dialog screenshots: AB, EF, HB/KB, already transferred result, preview error.

Closes #130.

- netResult/transferredResult now come from the debit/credit direction per
  account, so a result account whose normal side contradicts its class can
  no longer flip the sign of the result (profit posted as a loss)
- preview warns about result accounts with a class/normal-side mismatch
- already-transferred warning formats the natural-signed transferredResult
- closing dialog executes against the last previewed account and disables
  Execute when the closing-account field is edited
- regression test covering an INCOME account with debit normal side
@perNyfelt
perNyfelt merged commit 7dca53c into main Nov 14, 2026
3 checks passed
@perNyfelt
perNyfelt deleted the fix/130-year-end-result-transfer branch November 14, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Year-end closing zeroes all result accounts, breaking the closed year's income statement, comparison figures and SIE export

1 participant