-
- Downloads
[FIX] website: get the error view without parsing the view tree
Before this commit:
The `if` condition doing a `View._views_get` was supposed to be a sort of
'hack' for when the error occured in a child view (as the template raised would
be the parent, not the broken child).
But since we refactored that part to use etree, it was actually going into that
condition for every error even if the error was in the called template.
Proof is, we only set `editable` in that if condition, meaning going in the
else would actually prevent to show reset template.
Indeed the following code would always be true:
et = etree.fromstring(view.with_context(inherit_branding=False).read_combined(['arch'])['arch'])
node = et.find(exception.path.replace('/templates/t/', './'))
as read_combined returns all the view hierarchy DOM
Note: We could not fix this by checking exception.path against `arch` as we
could have false positive (eg the child view replace the <p> element by another
<p> element which is broken, then the path would be found in the parent view
even if the error was in the child view).
closes odoo/odoo#31515
Signed-off-by:
Jérémy Kersten (jke) <jke@openerp.com>
Showing
- addons/test_website/tests/test_reset_views.py 2 additions, 1 deletionaddons/test_website/tests/test_reset_views.py
- addons/website/models/ir_http.py 15 additions, 11 deletionsaddons/website/models/ir_http.py
- addons/website/models/ir_ui_view.py 1 addition, 1 deletionaddons/website/models/ir_ui_view.py
Loading
Please register or sign in to comment