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.

22 lines
581 B

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