Skip to content
Snippets Groups Projects
Commit e631bff0 authored by Louis (loco)'s avatar Louis (loco)
Browse files

[FIX] web_editor: save an image with the correct parameters

Steps to reproduce the problem:
- Go on the "Courses" application and select a course.
- Edit.
- Replace the main image of the course with one of your own.
- Save.

-> The function route `/web_editor/modify_image/` is called two times
leading to the creation of two attachments instead of one.

The `saveModifiedImages()` function iterates through editable elements
and calls `/web_editor/modify_image/` for each image with a
`o_modified_image_to_save` class inside those elements. In our case, the
image has an editable element parent that has itself an editable element
parent. Because since [1], the `o_modified_image_to_save` class is
removed after the `rpc` call, this class is not removed while the
`saveModifiedImages()` loops on the second editable element parent of
the image. As a result, `/web_editor/modify_image/` is called two times.
Note that before [1], the process was partially wrong as well.
`/web_editor/modify_image/` was indeed called only once but with the
wrong arguments. This is now fixed by ensuring that the function is
called with the arguments coming from the closest editable element.

[1]: https://github.com/odoo/odoo/commit/8872aab2d108ff3e2ec06ca4579479898c87738c



task-3451349

closes odoo/odoo#130472

Signed-off-by: default avatarRobin Lejeune (role) <role@odoo.com>
parent b96e23e2
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment