diff options
| author | Romain Derie <rde@odoo.com> | 2019-01-09 10:52:39 +0000 |
|---|---|---|
| committer | Romain Derie <rde@odoo.com> | 2019-01-09 13:09:26 +0000 |
| commit | 20e9d77be824c87b1d8e045bcc8f7c15c34a7836 (patch) | |
| tree | a5da2e79e1c935ed987e2071ef81b52ccd82d34d /addons/web/static/src/js/views/basic/basic_controller.js | |
| parent | 3ad5748cefc6f2481b6f5f6518bbf34f11bf36e3 (diff) | |
[FIX] website: correct order when copying view children on COW
Before this commit, a generic view tree could be valid but impossible to copy
on a COW specific tree.
This was because when looping through inherit_children_ids to copy them, they
would be sorted by the ir.ui.view sort order (name, priority, id).
Indeed, when applying view inheritance and reading a view arch, children are
sorted by (priority, id).
Thus, if sorting the children by (name, priority, id) was different than
sorting by (priority, id) and the children view would conflict in that new
order, the COW would raise an error "can't find DOM element"
Step to reproduce:
- Create a parent view with just a DIV in arch
- Add a child view that add something inside that DIV
- Add another child view with a name alphabetically lower than the other
child and that replace the DIV by something else, like a SECTION
- Everything works as expected, when reading the parent view arch, the first
child is inserting something into the DIV and then the second is replacing
the DIV
- Now try to trigger the COW on the parent view by writing something on it in
a website context
- It will crash as the child views will be copied in another order, sorted
firstly by name.
- Indeed, when reading parent view, the second child will be copied first as
it's name is lower than the first, it will then replace the DIV by a SPAN.
When trying to copy the other child view that is supposed to insert
something into the DIV, the DIV will not be found and it will crash.
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_controller.js')
0 files changed, 0 insertions, 0 deletions
