diff options
| author | Xavier-Do <xdo@odoo.com> | 2019-10-24 12:48:19 +0000 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2019-11-13 16:11:46 +0000 |
| commit | aae1d578296875a641d1142c0f73279fc134a151 (patch) | |
| tree | 5aab227cfe57fc42a83b7133453c94db091cfff0 /odoo/modules | |
| parent | b63e82bebda948d58e5adffe2f5aa7ea047c1514 (diff) | |
[REF] base: refactor check_xml and read_combined
View creation/edition represent a important part of an install and a lot
of possible view errors are not detected, like fields used in domain
filters. Some part of the code a difficult to maintain, and view checks
are splitted in multiple places.
This commit aims at refactoring view validation by regrouping most part
of the logic in ir_ui_view and trying to optimize the overall process.
Since most of the lines were touched, this task was also an opportunity
to modernize the API.
Main changes on method `check_xml`:
- extract node processign and validation to individual postprocessor
- add validation for filter node, buttons, ...
- fix accessibility checks (and improve their performance)
- move xpath check to specific Python node validator
- clarify error messages (wip to continue)
Main changes on method `read_combined`:
- optimize the search for inheriting views in a single query doing the
whole recursive search
Indeed, after removing xpath validations, `get_inheriting_views_arch`
was the most expensive method in `check_xml`, spending most of the time
in `search` because of recursive calls to retrieve children views.
The view Backend Assets is a good example of the latter point, since a
line is added in the view for almost every module. 70 views (community)
are added at first level, `get_inheriting_views_arch` is efficient and
returns all 70 views. Then at the second level, the method
`get_inheriting_views_arch` is called 70 times for nothing. 70 calls to
`search` (squared/2 since each view is checked independently) are almost
useless. The same case applies to the settings view.
As a result, the average module installation time is 25% faster, and the
average time spent in `read_combined` is almost divided by 2.
Diffstat (limited to 'odoo/modules')
0 files changed, 0 insertions, 0 deletions
