-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] web_editor: send the html editor writes one after another
With the following view hierarchy: A | B' (oe_structure_ID view) Before this fix, when saving multiple templates at once from the same hierarchy the COW views (website) would not be saved correctly as the first call to `write` would COW the parent view, then the second concurent call to `write` would create the child specific view under the generic parent view. Instead, the generic parent should have been cloned to a specific parent view and then the child view should be COW under the specific parent. A A' | | B' B*' (This one is the old B', without B' changes in the html editor) Instead of A A' | B' Calling the `write` one after another will do the trick. Indeed, when the second call is fired, the first call has already triggered the COW behavior. Thus, the second call correctly retrieves the COW view. Another issue might still appear, if the parent view write is sent first. Indeed, the parent view will be COW, thus the specific child view (second write waiting to be fired) will be deleted to be added on the new specific hierarchy. Thus, that write will then raise an error since the view does not exist anymore. task-1934279 Fix odoo#30447
- Loading branch information
Showing
4 changed files
with
113 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
odoo.define('website.test.html_editor', function (require) { | ||
'use strict'; | ||
|
||
var tour = require('web_tour.tour'); | ||
var base = require('web_editor.base'); | ||
|
||
tour.register('html_editor_multiple_templates', { | ||
test: true, | ||
url: '/aboutus', | ||
wait_for: base.ready(), | ||
}, | ||
[ | ||
// 1. Edit the page through Edit Mode, it will COW the view | ||
{ | ||
content: "enter edit mode", | ||
trigger: 'a[data-action=edit]', | ||
}, | ||
{ | ||
content: "drop a snippet", | ||
trigger: '#oe_snippets .oe_snippet:has(.s_cover) .oe_snippet_thumbnail', | ||
// id starting by 'oe_structure..' will actually create an inherited view | ||
run: "drag_and_drop #oe_structure_test_ui", | ||
}, | ||
{ | ||
content: "save the page", | ||
extra_trigger: '#wrapwrap .s_cover', | ||
trigger: "#web_editor-top-edit button[data-action=save]", | ||
}, | ||
// 2. Edit generic aboutus view | ||
{ | ||
content: "open customize menu", | ||
extra_trigger: "body:not(.editor_enable)", | ||
trigger: '#customize-menu > a', | ||
}, | ||
{ | ||
content: "open html editor", | ||
trigger: '#html_editor', | ||
}, | ||
{ | ||
content: "add something in the aboutus view", | ||
trigger: 'div.ace_line .ace_xml:contains("aboutus")', | ||
run: function () { | ||
ace.edit('ace-view-editor').getSession().insert({row: 3, column: 1}, '<p>somenewcontent</p>\n'); | ||
}, | ||
}, | ||
// 3. Edit oe_structure specific view | ||
{ | ||
content: "select oe_structure specific view", | ||
trigger: 'div.ace_line .ace_xml:contains("somenewcontent")', | ||
run: function () { | ||
var viewId = $('#ace-view-list option:contains("oe_structure")').val(); | ||
$('#ace-view-list').val(viewId).trigger('change'); | ||
}, | ||
}, | ||
{ | ||
content: "add something in the oe_structure specific view", | ||
trigger: 'div.ace_line .ace_xml:contains("s_cover")', | ||
run: function () { | ||
ace.edit('ace-view-editor').getSession().insert({row: 2, column: 1}, '<p>anothernewcontent</p>\n'); | ||
}, | ||
}, | ||
{ | ||
content: "save the html editor", | ||
extra_trigger: 'div.ace_line .ace_xml:contains("anothernewcontent")', | ||
trigger: ".o_ace_view_editor button[data-action=save]", | ||
}, | ||
{ | ||
content: "check that the page has both modification", | ||
extra_trigger: '#wrapwrap:contains("anothernewcontent")', | ||
trigger: '#wrapwrap:contains("somenewcontent")', | ||
run: function () {}, // it's a check | ||
}, | ||
] | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters