diff options
Diffstat (limited to 'addons/crm_sms')
| -rw-r--r-- | addons/crm_sms/models/crm_lead.py | 1 | ||||
| -rw-r--r-- | addons/crm_sms/tests/__init__.py | 3 | ||||
| -rw-r--r-- | addons/crm_sms/tests/test_crm_lead.py | 29 |
3 files changed, 33 insertions, 0 deletions
diff --git a/addons/crm_sms/models/crm_lead.py b/addons/crm_sms/models/crm_lead.py index 19e4379339e..76f7301cdfd 100644 --- a/addons/crm_sms/models/crm_lead.py +++ b/addons/crm_sms/models/crm_lead.py @@ -10,4 +10,5 @@ class CrmLead(models.Model): def _sms_get_number_fields(self): """ This method returns the fields to use to find the number to use to send an SMS on a record. """ + # TDE FIXME: to be cleaned in 14.4+ as it conflicts with _phone_get_number_fields return ['mobile', 'phone'] 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]) |
