Daily updates from Odoo
Tuesday, July 2, 2024
2 changes · 17.0
Enhancements to existing features
This update adds automated testing to verify that Balance Sheet reports are properly balanced across all localizations. The system now validates that debits equal credits in Balance Sheets by generating test transactions and checking the results, helping catch accounting errors early. This improvement ensures financial reports maintain their fundamental accounting principle of balanced entries.
Original PR description
This PR introduces a `l10n` test over the Balance Sheet reports. Each Balance Sheet report in the `LOC_DATA` global at the head of the file will be tested. The test generates a journal entry with a…
This PR introduces a `l10n` test over the Balance Sheet reports.
Each Balance Sheet report in the `LOC_DATA` global at the head of the file will be tested.
The test generates a journal entry with a line in every account that is not `off_balance`.
It then checks whether the Balance Sheet is balanced.
The test does this both for debits and for credits.
The test will give a warning for any installed Balance Sheet report which is not specified in the LOC_DATA global. The aim is to change this to an error once all existing Balance Sheets are tested, to make this test mandatory for any new localizations.
For each localization with a Balance Sheet, the test needs to know the XMLIDs of:
- the CoA
- the Balance Sheet report
- the Total Assets line of the Balance Sheet
- the Total Liabilities line of the Balance Sheet
- the Total Equity line of the Balance Sheet (if applicable)
Setting the global `IDENTIFY_INCORRECT_ACCOUNTS` to `True` switches the behaviour of the test: it identifies the accounts that cause the imbalance using a binary search. This is off by default for runbot.
**Performance impact**
- For each Balance Sheet, the test does the following:
- load the chart template
- create an account.move with 4 AMLs for each account (one debit and credit in the account; and one debit and credit in the counterpart account)
- generate the report once.
- The Binary Search (which can be toggled when testing locally) is quite efficient:
- If there is just one incorrect account, then the report needs to be generated `log2(<number of accounts>)` times.
- If there are `X` incorrect accounts, then in the worst-case the report may need to be generated `X * log2(<number of accounts>)` times.
On the Belgian CoA, with no incorrect accounts, the test takes 14s on my PC. With 4 incorrect accounts, the test takes 33s.
Task: 3060790
Forward-Port-Of: odoo/enterprise#36838This update improves how Odoo handles global discounts and negative line items by moving the core logic to the main accounting module. This allows other countries' localization modules to reuse the same discount handling approach, while the Mexico localization module continues to provide country-specific tax and document processing. This change makes the system more efficient and easier to maintain across different regions.
Original PR description
To allow other localizations to use the same logic for negative lines, we moved the methods in account. We still extend it in the module to add specific logic about taxes and documents. task-3943357