[IMP]: Added Upstream patch for Mail Mailing
This commit is contained in:
parent
2b13d02718
commit
bc3d5d7ba9
@ -11,6 +11,11 @@ from flectra.tools import consteq
|
|||||||
|
|
||||||
class MassMailController(http.Controller):
|
class MassMailController(http.Controller):
|
||||||
|
|
||||||
|
@http.route(['/unsubscribe_from_list'], type='http', website=True, multilang=False, auth='public')
|
||||||
|
def unsubscribe_placeholder_link(self, **post):
|
||||||
|
"""Dummy route so placeholder is not prefixed by language, MUST have multilang=False"""
|
||||||
|
raise werkzeug.exceptions.NotFound()
|
||||||
|
|
||||||
@http.route(['/mail/mailing/<int:mailing_id>/unsubscribe'], type='http', website=True, auth='public')
|
@http.route(['/mail/mailing/<int:mailing_id>/unsubscribe'], type='http', website=True, auth='public')
|
||||||
def mailing(self, mailing_id, email=None, res_id=None, token="", **post):
|
def mailing(self, mailing_id, email=None, res_id=None, token="", **post):
|
||||||
mailing = request.env['mail.mass_mailing'].sudo().browse(mailing_id)
|
mailing = request.env['mail.mass_mailing'].sudo().browse(mailing_id)
|
||||||
|
@ -92,7 +92,7 @@ class MailMail(models.Model):
|
|||||||
def send_get_email_dict(self, partner=None):
|
def send_get_email_dict(self, partner=None):
|
||||||
# TDE: temporary addition (mail was parameter) due to semi-new-API
|
# TDE: temporary addition (mail was parameter) due to semi-new-API
|
||||||
res = super(MailMail, self).send_get_email_dict(partner)
|
res = super(MailMail, self).send_get_email_dict(partner)
|
||||||
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url').rstrip('/')
|
||||||
if self.mailing_id and res.get('body') and res.get('email_to'):
|
if self.mailing_id and res.get('body') and res.get('email_to'):
|
||||||
emails = tools.email_split(res.get('email_to')[0])
|
emails = tools.email_split(res.get('email_to')[0])
|
||||||
email_to = emails and emails[0] or False
|
email_to = emails and emails[0] or False
|
||||||
|
@ -681,6 +681,7 @@ class MassMailing(models.Model):
|
|||||||
'mass_mailing_id': mailing.id,
|
'mass_mailing_id': mailing.id,
|
||||||
'mailing_list_ids': [(4, l.id) for l in mailing.contact_list_ids],
|
'mailing_list_ids': [(4, l.id) for l in mailing.contact_list_ids],
|
||||||
'no_auto_thread': mailing.reply_to_mode != 'thread',
|
'no_auto_thread': mailing.reply_to_mode != 'thread',
|
||||||
|
'template_id': None,
|
||||||
}
|
}
|
||||||
if mailing.reply_to_mode == 'email':
|
if mailing.reply_to_mode == 'email':
|
||||||
composer_values['reply_to'] = mailing.reply_to
|
composer_values['reply_to'] = mailing.reply_to
|
||||||
|
@ -38,7 +38,7 @@ FieldTextHtml.include({
|
|||||||
var datarecord = this._super();
|
var datarecord = this._super();
|
||||||
if (this.model === 'mail.mass_mailing') {
|
if (this.model === 'mail.mass_mailing') {
|
||||||
// these fields can potentially get very long, let's remove them
|
// these fields can potentially get very long, let's remove them
|
||||||
datarecord = _.omit(datarecord, ['mailing_domain', 'contact_list_ids', 'body_html']);
|
datarecord = _.omit(datarecord, ['mailing_domain', 'contact_list_ids', 'body_html', 'attachment_ids']);
|
||||||
}
|
}
|
||||||
return datarecord;
|
return datarecord;
|
||||||
},
|
},
|
||||||
|
@ -26,7 +26,7 @@ class TestMassMailing(models.TransientModel):
|
|||||||
'reply_to': mailing.reply_to,
|
'reply_to': mailing.reply_to,
|
||||||
'email_to': test_mail,
|
'email_to': test_mail,
|
||||||
'subject': mailing.name,
|
'subject': mailing.name,
|
||||||
'body_html': mailing.body_html,
|
'body_html': tools.html_sanitize(mailing.body_html, sanitize_attributes=True, sanitize_style=True, strip_classes=True),
|
||||||
'notification': True,
|
'notification': True,
|
||||||
'mailing_id': mailing.id,
|
'mailing_id': mailing.id,
|
||||||
'attachment_ids': [(4, attachment.id) for attachment in mailing.attachment_ids],
|
'attachment_ids': [(4, attachment.id) for attachment in mailing.attachment_ids],
|
||||||
|
Loading…
Reference in New Issue
Block a user