[FIX] mail: fix some typos

Fix some typos spotted in mail sending code.

Prepares Task-2684479 (Mail: Better send error storage and display)

Part-of: odoo/odoo#94660
This commit is contained in:
Thibault Delavallée
2022-06-27 16:25:54 +02:00
parent 15e907f54b
commit dc3d3f7dd8
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -434,7 +434,7 @@ class MailMail(models.Model):
# To avoid sending twice the same email, provoke the failure earlier
mail.write({
'state': 'exception',
'failure_reason': _('Error without exception. Probably due do sending an email without computed recipients.'),
'failure_reason': _('Error without exception. Probably due to sending an email without computed recipients.'),
})
# Update notification in a transient exception state to avoid concurrent
# update in case an email bounces while sending all emails related to current
@@ -445,7 +445,7 @@ class MailMail(models.Model):
('notification_status', 'not in', ('sent', 'canceled'))
])
if notifs:
notif_msg = _('Error without exception. Probably due do concurrent access update of notification records. Please see with an administrator.')
notif_msg = _('Error without exception. Probably due to concurrent access update of notification records. Please see with an administrator.')
notifs.sudo().write({
'notification_status': 'exception',
'failure_type': 'unknown',
+4 -4
View File
@@ -244,7 +244,7 @@ class TestMailMail(TestMailCommon):
mail.write({'email_to': email_to})
with self.mock_mail_gateway():
mail.send(raise_exception=False)
self.assertIn('Error without exception. Probably due do sending an email without computed recipients.', mail.failure_reason)
self.assertIn('Error without exception. Probably due to sending an email without computed recipients.', mail.failure_reason)
self.assertFalse(mail.failure_type, 'Mail: missing email_to: no failure type, should be updated')
self.assertEqual(mail.state, 'exception')
if email_to == ' ':
@@ -261,7 +261,7 @@ class TestMailMail(TestMailCommon):
mail.write({'email_to': email_to})
with self.mock_mail_gateway():
mail.send(raise_exception=False)
self.assertIn('Error without exception. Probably due do sending an email without computed recipients.', mail.failure_reason)
self.assertIn('Error without exception. Probably due to sending an email without computed recipients.', mail.failure_reason)
self.assertFalse(mail.failure_type, 'Mail: invalid email_to: no failure type, should be updated')
self.assertEqual(mail.state, 'exception')
self.assertEqual(notification.failure_type, failure_type, 'Mail: invalid email_to: missing instead of invalid')
@@ -322,7 +322,7 @@ class TestMailMail(TestMailCommon):
notification.write({'res_partner_id': partner.id})
with self.mock_mail_gateway():
mail.send(raise_exception=False)
self.assertEqual(mail.failure_reason, 'Error without exception. Probably due do sending an email without computed recipients.')
self.assertEqual(mail.failure_reason, 'Error without exception. Probably due to sending an email without computed recipients.')
self.assertFalse(mail.failure_type, 'Mail: void recipient partner: no failure type, should be updated')
self.assertEqual(mail.state, 'exception')
self.assertEqual(notification.failure_type, 'mail_email_invalid', 'Mail: void recipient partner: should be missing, not invalid')
@@ -335,7 +335,7 @@ class TestMailMail(TestMailCommon):
notification.write({'res_partner_id': partner.id})
with self.mock_mail_gateway():
mail.send(raise_exception=False)
self.assertEqual(mail.failure_reason, 'Error without exception. Probably due do sending an email without computed recipients.')
self.assertEqual(mail.failure_reason, 'Error without exception. Probably due to sending an email without computed recipients.')
self.assertFalse(mail.failure_type, 'Mail: invalid recipient partner: no failure type, should be updated')
self.assertEqual(mail.state, 'exception')
self.assertEqual(notification.failure_type, 'mail_email_invalid')