[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
This commit is contained in:
Antoine Guenet
2019-02-21 07:32:38 +00:00
parent 5cec06b179
commit 8b8d6d0a5b
@@ -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();