[IMP] mail: do not remove cancelled email during the sending
Purpose ======= It's not the role of the sending method to remove non outgoing emails. Task-2587345 Part-of: odoo/odoo#73271
This commit is contained in:
@@ -376,8 +376,6 @@ class MailMail(models.Model):
|
||||
try:
|
||||
mail = self.browse(mail_id)
|
||||
if mail.state != 'outgoing':
|
||||
if mail.state != 'exception' and mail.auto_delete:
|
||||
mail.sudo().unlink()
|
||||
continue
|
||||
|
||||
# remove attachments if user send the link with the access_token
|
||||
|
||||
@@ -92,3 +92,6 @@ class TestMassMailBlPerformance(TestMassMailPerformanceBase):
|
||||
|
||||
self.assertEqual(mailing.sent, 50)
|
||||
self.assertEqual(mailing.delivered, 50)
|
||||
|
||||
cancelled_mail_count = self.env['mail.mail'].sudo().search([('mailing_id', '=', mailing.id)])
|
||||
self.assertEqual(len(cancelled_mail_count), 12, 'Should not have auto deleted the blacklisted emails')
|
||||
|
||||
Reference in New Issue
Block a user