diff options
| author | Thibault Delavallée <tde@odoo.com> | 2021-05-11 14:14:00 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2021-05-11 14:27:50 +0000 |
| commit | 4b0c551194e8ef66df9136629afe71566ffe212e (patch) | |
| tree | 42fdc555e5081df99dbb3d6e94901df47f9a37e0 /addons/crm_sms/tests | |
| parent | d0db984990679a63714ca62e6b605d94af7d5c28 (diff) | |
[FIX] crm: correctly compute phone_sanitized without having crm_sms installed
Currently phone_sanitized computation on lead model works only if crm_sms
is installed. Indeed an override of ``_phone_get_number_fields`` is missing.
However ``_sms_get_number_fields`` coming with ``crm_sms`` and its ``sms``
dependency hides the issue as those modules are auto-install. However if
``crm_sms`` is uninstalled phone_sanitized is not correctly computed anymore.
Task ID-2528169
Oversight of odoo/odoo#45315
Diffstat (limited to 'addons/crm_sms/tests')
| -rw-r--r-- | addons/crm_sms/tests/__init__.py | 3 | ||||
| -rw-r--r-- | addons/crm_sms/tests/test_crm_lead.py | 29 |
2 files changed, 32 insertions, 0 deletions
diff --git a/addons/crm_sms/tests/__init__.py b/addons/crm_sms/tests/__init__.py new file mode 100644 index 00000000000..e6f86243ac6 --- /dev/null +++ b/addons/crm_sms/tests/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import test_crm_lead diff --git a/addons/crm_sms/tests/test_crm_lead.py b/addons/crm_sms/tests/test_crm_lead.py new file mode 100644 index 00000000000..f5659da8301 --- /dev/null +++ b/addons/crm_sms/tests/test_crm_lead.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo.addons.crm.tests.common import TestCrmCommon +from odoo.tests.common import Form, users + + +class TestCRMLead(TestCrmCommon): + + @users('user_sales_manager') + def test_phone_mobile_update(self): + lead = self.env['crm.lead'].create({ + 'name': 'Lead 1', + 'country_id': self.env.ref('base.us').id, + 'phone': self.test_phone_data[0], + }) + self.assertEqual(lead.phone, self.test_phone_data[0]) + self.assertFalse(lead.mobile) + self.assertEqual(lead.phone_sanitized, self.test_phone_data_sanitized[0]) + + lead.write({'phone': False, 'mobile': self.test_phone_data[1]}) + self.assertFalse(lead.phone) + self.assertEqual(lead.mobile, self.test_phone_data[1]) + self.assertEqual(lead.phone_sanitized, self.test_phone_data_sanitized[1]) + + lead.write({'phone': self.test_phone_data[1], 'mobile': self.test_phone_data[2]}) + self.assertEqual(lead.phone, self.test_phone_data[1]) + self.assertEqual(lead.mobile, self.test_phone_data[2]) + self.assertEqual(lead.phone_sanitized, self.test_phone_data_sanitized[2]) |
