You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
608 B

  1. # coding: utf-8
  2. # © 2017 David BEAL @ Akretion
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. import logging
  5. from odoo import models
  6. _logger = logging.getLogger(__name__)
  7. try:
  8. from premailer import transform
  9. except (ImportError, IOError) as err:
  10. _logger.debug(err)
  11. class MailTemplate(models.Model):
  12. _inherit = 'mail.template'
  13. def generate_email(self, res_ids, fields=None):
  14. res = super(MailTemplate, self).generate_email(res_ids, fields=fields)
  15. if 'body_html' in res:
  16. res['body_html'] = transform(res['body_html'])
  17. return res