diff --git a/addons/test_website/tests/test_reset_views.py b/addons/test_website/tests/test_reset_views.py index b5f1d845bac..c927ffd32ba 100644 --- a/addons/test_website/tests/test_reset_views.py +++ b/addons/test_website/tests/test_reset_views.py @@ -19,17 +19,17 @@ class TestWebsiteResetViews(odoo.tests.HttpCase): login="admin" ) - def fix_it(self, page): + def fix_it(self, page, mode='soft'): self.authenticate("admin", "admin") resp = self.url_open(page) self.assertEqual(resp.status_code, 500, "Waiting 500") - self.assertTrue('). - et = etree.fromstring(view.with_context(inherit_branding=False).read_combined(['arch'])['arch']) - node = et.xpath(exception.path) - line = node is not None and etree.tostring(node[0], encoding='unicode') - if line: - values['views'] = View._views_get(exception_template).filtered( - lambda v: line in v.arch - ) - # Keep only views that we can reset - values['views'] = values['views'].filtered( - lambda view: view._get_original_view().arch_fs or 'oe_structure' in view.key - ) + # There might be 2 cases where the exception code can't be found + # in the view, either the error is in a child view or the code + # contains branding (
). + et = etree.fromstring(view.with_context(inherit_branding=False).read_combined(['arch'])['arch']) + node = et.xpath(exception.path) + line = node is not None and etree.tostring(node[0], encoding='unicode') + if line: + values['view'] = View._views_get(exception_template).filtered( + lambda v: line in v.arch + ) + values['view'] = values['view'] and values['view'][0] + # Needed to show reset template on translated pages (`_prepare_qcontext` will set it for main lang) values['editable'] = request.uid and request.website.is_publisher() elif code == 403: diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index 82c3c2c0549..36e376975d2 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -1027,12 +1027,18 @@ + -