From f7364424f63c319529208700ffb08f2046db841f Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 28 Jan 2021 11:28:09 +0000 Subject: [PATCH] [FIX] mass_mailing: save error does not break inlining Scenario: - create mass mailing with icons and without title - save and get error "The followign fields are invalid: Subject" - fill subject and save - edit => the icons have disappeared This is because mass mailing widget is using: - a "body_html" field that contains inlined html - a wysiwyg editor to edit field "body_arch" - a textarea containing "body_arch" value to be saved When we save this happens: 1. we save the current value of wysiwyg into textarea 2. wysiwyg content is inlined (eg. transforming font in image) 3. inlined wysiwyg content is set to "body_html" field 4. if there: - is no error while saving => body_html and body_arch are saved and will be used on next edition - if there is an error the fields are not saved, and we now have an inlined content on wysiwyg, so next time we save the "body_arch" is going to be inlined: => this for example breaking the icons on edition Issue discovered when fixing opw-2447756 closes #65208 closes odoo/odoo#65221 X-original-commit: 0f5f53837bc403960e307ab85e9fe68423c23f5f Signed-off-by: Nicolas Lempereur (nle) --- addons/mass_mailing/static/src/js/mass_mailing_widget.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/mass_mailing/static/src/js/mass_mailing_widget.js b/addons/mass_mailing/static/src/js/mass_mailing_widget.js index 6d10529e31a..b39cb91734f 100644 --- a/addons/mass_mailing/static/src/js/mass_mailing_widget.js +++ b/addons/mass_mailing/static/src/js/mass_mailing_widget.js @@ -86,6 +86,7 @@ var MassMailingFieldHtml = FieldHtml.extend({ dataPointID: self.dataPointID, changes: _.object([fieldName], [self._unWrap($editable.html())]) }); + self.wysiwyg.setValue(result.html); if (self._isDirty && self.mode === 'edit') { return self._doAction();