[FIX] mail: Remove failure_type and failure_reason when mail successfully sent

When sending a message (e.g. in a CRM lead or SO),
a failure_type and failure_reason are displayed, even when the message
is successfully sent.

This is because these fields are not updated when the email_status
is changed to "sent". We reset these fields to '' when the message is sent.

OPW-2003290

closes odoo/odoo#34082

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
This commit is contained in:
Fanny He
2019-06-12 15:13:36 +00:00
parent f417acc2c7
commit 3c45f08825
+2
View File
@@ -172,6 +172,8 @@ class MailMail(models.Model):
messages._notify_failure_update() # notify user that we have a failure
(notifications - failed).sudo().write({
'email_status': 'sent',
'failure_type': '',
'failure_reason': '',
})
if not failure_type or failure_type == 'RECIPIENT': # if we have another error, we want to keep the mail.
mail_to_delete_ids = [mail.id for mail in self if mail.auto_delete]