diff options
| author | Hugo Adan <hugo@vauxoo.com> | 2019-01-12 01:16:45 +0000 |
|---|---|---|
| committer | Hugo Adan <hugo@vauxoo.com> | 2019-02-13 14:55:29 +0000 |
| commit | a9fa46fdc8b98c44a8b0966b94ae623ec3ff66ba (patch) | |
| tree | 8904374d8c64134ed037dff9a0ed5c2664bc86eb /addons/mass_mailing/models | |
| parent | 090c3a06c8ddd187bb8f3fc5501a7bece7a11662 (diff) | |
[FIX] mass_mailing: make retry failed mail work with keep archive set to False
Let M be a mass_mailing.
For all messages m related to M, retry_failed_mail removes the mail
statistics
of m before putting M 'in_queue'.
Since there are no statistics on m, its recipient is returned by the
function
get_remaining_recipients when called by send_mail once M is processed.
However when keep archive is set to False, the 'mail.mail' records
are automatically removed. As a results their statistics are not
removed,
and thus these mails are not retried.
closes odoo/odoo#30158
Diffstat (limited to 'addons/mass_mailing/models')
| -rw-r--r-- | addons/mass_mailing/models/mass_mailing.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/addons/mass_mailing/models/mass_mailing.py b/addons/mass_mailing/models/mass_mailing.py index f4753f9bd07..3c1fa6dcc46 100644 --- a/addons/mass_mailing/models/mass_mailing.py +++ b/addons/mass_mailing/models/mass_mailing.py @@ -558,6 +558,12 @@ class MassMailing(models.Model): failed_mails = self.env['mail.mail'].search([('mailing_id', 'in', self.ids), ('state', '=', 'exception')]) failed_mails.mapped('statistics_ids').unlink() failed_mails.sudo().unlink() + res_ids = self.get_recipients() + except_mailed = self.env['mail.mail.statistics'].search([ + ('model', '=', self.mailing_model_real), + ('res_id', 'in', res_ids), + ('exception', '!=', False), + ('mass_mailing_id', '=', self.id)]).unlink() self.write({'state': 'in_queue'}) #------------------------------------------------------ |
