From 8b8d6d0a5b2ab6255f9fd3bec4284f371f1282c8 Mon Sep 17 00:00:00 2001 From: Antoine Guenet Date: Thu, 21 Feb 2019 07:32:38 +0000 Subject: [PATCH] [FIX] web_editor: do nothing on save if no media was selected in modal When in the media modal, if one selected no media but clicked the "ADD" button it resulted in an error and a failed RPC instead of simply closing the modal without doing anything. v12 behavior is now restored. closes odoo/odoo#31308 --- addons/web_editor/static/src/js/wysiwyg/plugin/media.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/media.js b/addons/web_editor/static/src/js/wysiwyg/plugin/media.js index b4d484af805..e60cfbe8039 100644 --- a/addons/web_editor/static/src/js/wysiwyg/plugin/media.js +++ b/addons/web_editor/static/src/js/wysiwyg/plugin/media.js @@ -151,6 +151,9 @@ var MediaPlugin = AbstractPlugin.extend({ * @param {Object} data contains the media to insert */ insertMedia: function (previous, data) { + if (!data.media) { + return; + } var newMedia = data.media; this._wrapCommand(function () { this.$editable.focus();