diff options
| author | Thibault Delavallée <tde@odoo.com> | 2020-04-30 13:27:26 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-04-30 14:47:49 +0000 |
| commit | c5c7a02302f6095c2ecf1e215421a8c9ff630638 (patch) | |
| tree | d106f752ab55b393b625f35f7b1b8325b16244fd /addons/test_mail_full | |
| parent | 9a3581d925af1a00849418608fd5db6d3cae203b (diff) | |
[FIX][IMP] sms: create failed notification when SMS-ing record without any phone number
When no valid phone number was found on a record, and when using _message_sms
directly, no SMS and no notification was created. You could therefore think
everything was ok while it was actually not.
Instead we now create failed notifications. It allows to be notified of it
and fix numbers through cancel / resend wizards.
Task ID 2244192
closes odoo/odoo#50486
X-original-commit: baecdfaa2d31714a20d1fb8af7799af1805cd939
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/test_mail_full')
| -rw-r--r-- | addons/test_mail_full/tests/test_sms_post.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/addons/test_mail_full/tests/test_sms_post.py b/addons/test_mail_full/tests/test_sms_post.py index 26b5c5268b5..e0c67d1407f 100644 --- a/addons/test_mail_full/tests/test_sms_post.py +++ b/addons/test_mail_full/tests/test_sms_post.py @@ -105,9 +105,8 @@ class TestSMSPost(test_mail_full_common.TestSMSCommon, test_mail_full_common.Tes with self.mockSMSGateway(): messages = record._message_sms(self._test_body) - # should not crash but no sms / no recipients - notifs = self.env['mail.notification'].search([('mail_message_id', 'in', messages.ids)]) - self.assertFalse(notifs) + # should not crash but have a failed notification + self.assertSMSNotification([{'partner': self.env['res.partner'], 'number': False, 'state': 'exception', 'failure_type': 'sms_number_missing'}], self._test_body, messages) def test_message_sms_on_field_w_partner(self): with self.with_user('employee'), self.mockSMSGateway(): @@ -137,7 +136,8 @@ class TestSMSPost(test_mail_full_common.TestSMSCommon, test_mail_full_common.Tes test_record = self.env['mail.test.sms'].browse(self.test_record.id) messages = test_record._message_sms(self._test_body) - self.assertNoSMSNotification(messages) + # should not crash but have a failed notification + self.assertSMSNotification([{'partner': self.env['res.partner'], 'number': False, 'state': 'exception', 'failure_type': 'sms_number_missing'}], self._test_body, messages) def test_message_sms_on_field_wo_partner_default_field(self): self.test_record.write({'customer_id': False}) |
