Thursday, July 11, 2024
1 change · 17.0
Resolved issues and error corrections
This fix corrects a critical issue in the disallowed expenses fleet report where transaction lines were being incorrectly grouped together when account IDs and vehicle IDs happened to match numerically. The fix ensures that expenses are properly separated by vehicle and account, preventing data misrepresentation and system crashes in the report display.
Original PR description
## [FIX] account_disallowed_expenses_fleet: query is mixing apple and pear The aim of this commit is to make the report behaves correctly when facing a DB with a lot of vehicles and a lot of accounts…
## [FIX] account_disallowed_expenses_fleet: query is mixing apple and pear The aim of this commit is to make the report behaves correctly when facing a DB with a lot of vehicles and a lot of accounts by making the query `group by` and `order by` more robust. Context: - 1 account and 1 vehicle share the same number for the id - the account is tagged with disallowed expense tag - 1 `account.move.line` without vehicle in that account - 1 `account.move.line` with a vehicle (with a dna rate) in the same account Before the commit: - The computation is giving wrong result in the report: 2 `account.move.line` were aggregated together under the hierarchy of the account without vehicle and the vehicle doesn't appear in the report at all. cause: the `CASE WHEN` could return, for example `92` as a `vehicle_id` and then `92` as an `account_id` and thus have them regrouped together. - 2 lines of the report were sharing the same "line_id" (the id given by report framework id, see method `_build_line_id`) which are used in a t-key property in an OWL loop resulting in a crash for the front-end. After the commit: - The 2 lines are aggregated seperatly: The line without `vehicle_id` is under the hierarchy of the account and the line with `vehicle_id` is under the hierachy of the concerned vehicle. - The line doesn't share any line_id anymore task-id: None (issue discovered in our own prod) ## [IMP] account_reports: ensure line_id is uniq in tests Moved to https://github.com/odoo/enterprise/pull/66216 Forward-Port-Of: odoo/enterprise#64166