Friday, April 11, 2025
1 change · saas-18.2
Enhancements to existing features
Expense team approvers can now open invoices much faster because the access check uses a smaller expense-related data source instead of scanning a very large accounting table. This removes a major slowdown, reducing invoice opening time in the benchmark from nearly 30 seconds to under half a second.
Original PR description
Description ------------ The current `ir.rule` for `account.move` for users in the `hr_expense.group_hr_expense_team_approver` group involves checking if any `account.move.line` are linked to an `expense_id`. This requires querying `account.move.line`, which is a large table and lacks indexing on `expense_id`, resulting in a performance bottleneck due to sequential scans. Instead, this can be simplified by utilizing the `expense_ids` field to directly query the significantly smaller `hr.expense` table. This approach is valid under the assumption that for a given `move`, `move.line_ids.expense_id` is always part of `move.expense_ids`. Benchmark ---------- On odoo.com, for a user in the expense team approver group, opening an invoice now takes: | Before | After | Speedup | |--------|-------|---------| | 29.7s | 340ms | 87x | Reference --------- opw-4720221 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr