Skip to content

v2.1.0 - Non calendar years, repair and report fixes

Latest

Choose a tag to compare

@ekmungai ekmungai released this 30 Oct 20:49
· 4 commits to main since this release
1fcf6ec

A minor release that fixes reporting for entities whose financial year does not start in January, adds a tool to repair the data earlier versions left behind, and fixes several balance and report bugs. If an Entity's year does not start in January, or you use MySQL or MariaDB, read Upgrading below.

Added

  • python_accounting.utils.reporting_period_repair finds and repairs the Reporting Periods and Balances that earlier versions left wrong. find(session) only lists them, and repair(session, findings) applies the changes (#38).

Fixes

  • For an Entity whose year does not start in January, the current Reporting Period follows year_start and reports use the period containing their end date (#35, #36).
  • A Balance stays in its Reporting Period when it is edited, deleted or restored. Each of those moved it to the current period, out of the opening balances of its own year. Its date is now checked against its own period.
  • The opening balance of a report or statement no longer counts Transactions dated on its start date twice, and a statement's opening balance now includes movement before its start date.
  • A statement with no Transactions closes at its opening balance, rather than 0.
  • A report whose start date is before the Entity's first Reporting Period no longer raises MissingReportingPeriodError.
  • MySQL and MariaDB keep the microseconds of dates. MySQL rounded them to the second, so Transaction.is_secure failed for valid Transactions dated half a second or more past the second.
  • ReportingPeriod.date_year without an Entity returns the year of the given date.
  • python_accounting.reports can be imported before python_accounting.models.

Documentation

  • The quickstart and examples now run as written, and new pages cover install requirements, configuration, bulk assignment and repair (#38).

Upgrading

  • Entities whose year does not start in January: run the repair straight after upgrading. Until then, sales can be rejected and default-dated reports can fail between January and the year start. Review find(session) before calling repair: Balances in a period that has already begun are matched on created_at, which holds the time the application started rather than the time they were saved.
  • MySQL and MariaDB: create_all does not alter existing tables, so change their DATETIME columns to DATETIME(6). Rows already rounded stay rounded, so Transactions affected by the bug keep failing is_secure.
  • Balances already moved by an edit stay where they are, as their original period is not recorded.
  • Editing is stricter: a saved Balance dated within its own period raises InvalidBalanceDateError, unless the Entity allows mid-year balances, until its date is corrected.