From b837bbdd8bf1edd5f93edbd0504361fb6ae7a794 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 1 Jun 2018 15:07:29 +0200 Subject: [PATCH 1/2] [FIX] mass_mailing: unsubscribe if trailing '/' If the `web.base.url` contains a trailing `/`, the replacement of the `/unsubscribe_from_list` link won't work since the string to replace will be `my_url//unsubscribe_from_list` instead of `my_url/unsubscribe_from_list`. Fixes #24731 opw-1848572 --- addons/mass_mailing/models/mail_mail.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mass_mailing/models/mail_mail.py b/addons/mass_mailing/models/mail_mail.py index f4611a3250c..1981dbd6b61 100644 --- a/addons/mass_mailing/models/mail_mail.py +++ b/addons/mass_mailing/models/mail_mail.py @@ -95,6 +95,8 @@ class MailMail(osv.Model): res = super(MailMail, self).send_get_email_dict(cr, uid, ids, partner, context=context) mail = self.browse(cr, uid, ids[0], context=context) base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url') + if base_url.endswith('/'): + base_url = base_url.rstrip('/') if mail.mailing_id and res.get('body') and res.get('email_to'): emails = tools.email_split(res.get('email_to')[0]) email_to = emails and emails[0] or False From 0046bf72925a61b99d82ee9ce758df206c6b6aa5 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Mon, 4 Jun 2018 11:27:18 +0200 Subject: [PATCH 2/2] [FIX] web_editor: disable button when html field loading Backporting bed33e1 and 472c5a4f9fa262f2ec2e10f4ad3e97c8c1bf4083 from v10.0 OPW 1853150 closes #25043 --- addons/web_editor/static/src/js/backend.js | 27 ++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/addons/web_editor/static/src/js/backend.js b/addons/web_editor/static/src/js/backend.js index 8677b683da5..b1b3a0c38fa 100644 --- a/addons/web_editor/static/src/js/backend.js +++ b/addons/web_editor/static/src/js/backend.js @@ -289,12 +289,32 @@ var FieldTextHtml = widget.extend({ src += "&datarecord="+ encodeURIComponent(JSON.stringify(datarecord)); return src; }, + _toggleFormButtons: function(enable) { + if (this.$formButtons) { + if (enable) { + this.$formButtons.find('button').removeClass('o_disabled').attr('disabled', false); + } else { + this.$formButtons.find('button').addClass('o_disabled').attr('disabled', true); + } + } + }, initialize_content: function() { var self = this; + + // Do not Forward port in >= 10.0 + function getModalButtons() { + var $modal = self.getParent().getParent(); + if ($modal && $modal.$footer) { + return $modal.$footer; + } + } + + this.$formButtons = this.getParent().$buttons || getModalButtons(); this.$el.closest('.modal-body').css('max-height', 'none'); this.$iframe = this.$el.find('iframe'); // deactivate any button to avoid saving a not ready iframe - $('.o_cp_buttons, .o_statusbar_buttons').find('button').addClass('o_disabled').attr('disabled', true); + // Do not Forward port in >= 10.0 + this._toggleFormButtons(false); this.document = null; this.$body = $(); this.$content = $(); @@ -321,7 +341,8 @@ var FieldTextHtml = widget.extend({ this._dirty_flag = false; this.render_value(); // reactivate all the buttons when the field's content (the iframe) is loaded - $('.o_cp_buttons, .o_statusbar_buttons').find('button').removeClass('o_disabled').attr('disabled', false); + // Do not Forward port in >= 10.0 + this._toggleFormButtons(true); setTimeout(function () { self.add_button(); setTimeout(self.resize,0); @@ -424,6 +445,8 @@ var FieldTextHtml = widget.extend({ } }, destroy: function () { + // Do not Forward port in >= 10.0 + this._toggleFormButtons(true); $(window).off('resize', this.resize); delete window.odoo[this.callback+"_editor"]; delete window.odoo[this.callback+"_content"];