Repository navigation
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_repairfinds and repairs the Reporting Periods and Balances that earlier versions left wrong.find(session)only lists them, andrepair(session, findings)applies the changes (#38).
Fixes
- For an Entity whose year does not start in January, the current Reporting Period follows
year_startand 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_securefailed for valid Transactions dated half a second or more past the second. ReportingPeriod.date_yearwithout an Entity returns the year of the given date.python_accounting.reportscan be imported beforepython_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 callingrepair: Balances in a period that has already begun are matched oncreated_at, which holds the time the application started rather than the time they were saved. - MySQL and MariaDB:
create_alldoes not alter existing tables, so change their DATETIME columns to DATETIME(6). Rows already rounded stay rounded, so Transactions affected by the bug keep failingis_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.