From b8176448c3e2b284fb094218ed88afe30e83e69a Mon Sep 17 00:00:00 2001 From: Antoine Guenet Date: Tue, 8 Feb 2022 13:51:46 +0000 Subject: [PATCH] [FIX] web_editor: ensure uploaded images in backend are not public When uploading an image in the editor, we go through `_attachment_create`, which sets the image to public if `res_model` is `ir.ui.view` (the default if none was passed). Because of a wrong reference to the editable DOM element (which contains the `res_model` as data), when instantiating the media dialog, we were passing no `res_model`. As a result, when saving an attachment, no `res_model` was passed to `_attachment_create` and the attachment was made public. Attachments in the backend should not be public and should be linked to the proper model. task-2759034 closes odoo/odoo#85132 X-original-commit: 5b664f0c04433091c3d6f85f245887d1808c308f Signed-off-by: David Monjoie (dmo) --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index f3375ced549..53e9d2d3b01 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -1008,7 +1008,7 @@ const Wysiwyg = Widget.extend({ const restoreSelection = preserveCursor(this.odooEditor.document); const $node = $(params.node); - const $editable = $(OdooEditorLib.closestElement(range.startContainer, '.o_editable')); + const $editable = $(this.odooEditor.editable); const model = $editable.data('oe-model'); const field = $editable.data('oe-field'); const type = $editable.data('oe-type');