[FIX] mass_mailing: load images in emails

The emails containing emails generated with the image widget have absolute path (src='/website/static/...'), adding <base> tag allows the mail client to load it correctly.
This commit is contained in:
Martin Trigaux 2014-07-09 16:42:22 +02:00
parent 407bb5d23e
commit fa44bdb486
1 changed files with 5 additions and 0 deletions

View File

@ -74,6 +74,11 @@ class MailMail(osv.Model):
""" Override to add the tracking URL to the body. """
body = super(MailMail, self).send_get_mail_body(cr, uid, mail, partner=partner, context=context)
# prepend <base> tag for images using absolute urls
domain = self.pool.get("ir.config_parameter").get_param(cr, uid, "web.base.url", context=context)
base = "<base href='%s'>" % domain
body = tools.append_content_to_html(base, body, plaintext=False, container_tag='div')
# generate tracking URL
if mail.statistics_ids:
tracking_url = self._get_tracking_url(cr, uid, mail, partner, context=context)