Files
odoo_source/addons/purchase/models
Antoine Boonen 2b95b87571 [IMP] account: improve performance of is_used computation on account.tax
Problem
---------
The compute_is_used function currently parses through a huge amount of
data using the _read_group ORM function. Which causes some performance
issues in large databases.

Objective
---------
Improve performance of the said function.

Solution
---------
Instead of reading the data on whole tables (ex.account_move_line), we
read the relation table between the modules and the taxes. This is done
using SQL queries with the EXISTS statement.
Furthermore, the code logic is modified so that if all the taxes for
which we compute `is_used` have been found, we don't look further in
other modules since doing this cannot add an new relevant information
and actually slows down the computation.

closes odoo/odoo#139497

Signed-off-by: Quentin De Paoli <qdp@odoo.com>
2023-11-04 00:38:16 +00:00
..