Files
odoo_source/addons/website/models
9aca84895f [REF] base: view hierarchy retrieval and combination
The view methods `get_inheriting_views_arch`, `apply_view_inheritance`,
`_apply_view_inheritance` and (previously `read_combined`)
`_get_combined_arch` were complicated and not optimal performance-wise.

The previous approach to retrieve views and combine them was to perform
it recursively, one primary view at a time.  This new approach retrieves
in a single SQL query the whole tree of views to combine.  The order of
view combination has been reproduced to be fully backward-compatible.

We also introduced various optimisations such as pre-fetching and
caching.

**get_inheriting_view_arch**

The method have been renamed `get_inheriting_views` as it returns a
recordset of views instead of the xml architecture of each view.

During an upgrade, only the views that have been fully upgrade already
are safe to be used. The views returned by the query are filtered to
remove any not-upgrade-yet view. Because this part is highly specific,
it has been isolated in a dedicated private method.

View extensions can be discarded according to user groups.  The
retrieval of groups on views is also made by the same query.  This
reduces the number of SQL queries, and makes the filtering faster.

**apply_view_inheritance**, **apply_view_inheritance**

The functions were responsible to build a hierarchy of views and to
iterate it to combine the views.

The hierarchy building have been moved to `_get_combined_view` and the
actual combination have been moved to a new method `_combine` and
documented.

Task: 2541579
Meta task: 2463632

Co-authored-by: Fabien Pinckaers <fp@odoo.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
2021-06-11 17:09:04 +00:00
..
2021-03-31 13:57:17 +02:00
2021-03-31 13:57:17 +02:00