From a27fbf4aaf02a0b9f5f3fe3979075e96047a6df5 Mon Sep 17 00:00:00 2001 From: Rodolpho Lima Date: Thu, 16 Mar 2023 16:47:26 +0000 Subject: [PATCH] [FIX] mass_mailing: re-display sidebar in non-basic themed mailing Steps to reproduce bug: Loop through the form view of mailing records having at least one of them the 'basic' theme, and the other ones any other theme. Once a mailing has the 'basic' theme, the sidebar is hidden (expected behaviour). But the sidebar will remain hidden for all mailing records, even the ones based on different themes (that would normally display the sidebar). The cause: There's a CSS rule to make 'display: none' when the iframe's body has the 'o_basic_theme' class. (see addons/mass_mailing/static/src/scss/mass_mailing.ui.scss) And the theme class is not properly cleared when switching between records of different themes. This commit fixes the issue by properly removing any theme classes before adding the current theme's one. Part-of: odoo/odoo#117166 --- addons/mass_mailing/static/src/js/mass_mailing_html_field.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mass_mailing/static/src/js/mass_mailing_html_field.js b/addons/mass_mailing/static/src/js/mass_mailing_html_field.js index 614e62f17ec..9af8053cbd1 100644 --- a/addons/mass_mailing/static/src/js/mass_mailing_html_field.js +++ b/addons/mass_mailing/static/src/js/mass_mailing_html_field.js @@ -406,6 +406,8 @@ export class MassMailingHtmlField extends HtmlField { $target.parents('.o_mail_template_preview').remove(); }); + // Clear any previous theme class before adding new one. + this.wysiwyg.$iframeBody.closest('body').removeClass(this._themeClassNames); let selectedTheme = this._getSelectedTheme(themesParams); if (selectedTheme) { this.wysiwyg.$iframeBody.closest('body').addClass(selectedTheme.className);