[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:Robin Lejeune (role) <role@odoo.com>
Loading
Please register or sign in to comment