account-financial-reporting
account-financial-reporting copied to clipboard
[16.0][FIX] account_financial_report: Remove inactive analytic account relations
When an analytic account is set to inactive (active=False), the relation with Journal Item is not automatically removed. This causes inactive analytic accounts to still appear linked to journal items when grouping by Analytic Account.
-
Current behavior before PR
- When using the edition mode in tree view from Journal Items, when removing an Analytic Account, the field
analytic_account_ids
is updated. - Here is the behavior with active analytic accounts. test_with_active_account.webm
- Inactive analytic accounts are not being unlinked from
account.move.line
records. test_with_inactive_account.webm
- When using the edition mode in tree view from Journal Items, when removing an Analytic Account, the field
-
Behavior with PR
- With this PR, the relation is properly removed and Journal Item is not linked to inactive account test_with_pr.webm
Changes
- Remove
self.analytic_account_ids = False
- Replace with:
self.with_context(active_test=False).analytic_account_ids = [(6, 0, [])]
to consider archived analytic account.