From 326a44c3f7f754160c78649f7c6c69dc0c030d92 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Fri, 25 Jan 2019 10:35:22 +0000 Subject: [FIX] web_editor, website: consider COW view when loading view Before this commit: 1. If we were editing a template with no xml_id, typically the case when editing a specific view (COW'd), the 'Template ID' label would be left empty as the view does not have an xml_id but only a key. 2. If we were editing a generic view, the template would be COW'd and replaced by the specific one created during the save. After the save, the page would be reload and will try to reopen the edited template (stored in url `res=123`). But as this template would be replaced by the COW'd view, the JS would crash trying to access an inexisting view. The HTML editor would then open in a very thin modal, barely editable. Now: 1. Display the template's key instead of its xml_id. The key is basically a duplicate of the xml_id, mainly used in website. 2. If we are saving a generic view, we search for its newly created specific view to upload the URL hash before reloading. task-1934279 Fix #30447 --- addons/website/static/src/js/html_editor.test.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/website/static/src/js/html_editor.test.js') diff --git a/addons/website/static/src/js/html_editor.test.js b/addons/website/static/src/js/html_editor.test.js index a57e7d4ea22..6c7633cf7aa 100644 --- a/addons/website/static/src/js/html_editor.test.js +++ b/addons/website/static/src/js/html_editor.test.js @@ -54,6 +54,7 @@ tour.register('html_editor_multiple_templates', { }, { content: "add something in the oe_structure specific view", + extra_trigger: '#ace-view-id:contains("website.aboutus_oe_structure_test_ui")', // If no xml_id it should show key trigger: 'div.ace_line .ace_xml:contains("s_cover")', run: function () { ace.edit('ace-view-editor').getSession().insert({row: 2, column: 1}, '

anothernewcontent

\n'); -- cgit v1.2.3