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.

20 lines
731 B

  1. # -*- coding: utf-8 -*-
  2. # © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from openerp import models, api
  5. class MailMail(models.Model):
  6. _inherit = 'mail.mail'
  7. @api.model
  8. def _postprocess_sent_message(self, mail, mail_sent=True):
  9. # Read before super, because mail will be removed if sent successfully
  10. stats = mail.statistics_ids
  11. res = super(MailMail, self)._postprocess_sent_message(
  12. mail, mail_sent=mail_sent)
  13. for stat in stats.filtered(
  14. lambda r: r.mass_mailing_sending_id.state == 'sending'):
  15. stat.mass_mailing_sending_id._process_sending()
  16. return res