From 50418c481182cb414792da32f2a0529503e59f9c Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 13 Jun 2018 17:04:34 +0200 Subject: [PATCH] [FIX] web_editor: properly save media dialog without any image When saving the media dialog without any selected image, a crash occurred. Now, it properly closes the dialog. opw-1858614 --- addons/web_editor/static/src/js/widgets.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/web_editor/static/src/js/widgets.js b/addons/web_editor/static/src/js/widgets.js index b7e21996e45..675c5c60598 100644 --- a/addons/web_editor/static/src/js/widgets.js +++ b/addons/web_editor/static/src/js/widgets.js @@ -326,8 +326,7 @@ var ImageDialog = Widget.extend({ var img = this.images[0]; if (!img) { - var id = this.$(".existing-attachments [data-src]:first").data('id'); - img = _.find(this.images, function (img) { return img.id === id;}); + return this.media; } if (!img.is_document) {