summaryrefslogtreecommitdiff
path: root/addons/crm/tests/common.py
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2021-03-15 09:43:55 +0000
committerThibault Delavallée <tde@odoo.com>2021-03-15 11:34:03 +0000
commit9733c22d0645459a0e5f280f59242dd31070d9b2 (patch)
tree5858593c99a896e1255b7247ee0f49bed9038eb6 /addons/crm/tests/common.py
parentab189bbaa723003223fab5b7f58044fd5ef021cd (diff)
[IMP] crm: improve phone / email tests for lead / partner sync
Purpose of this commit is to improve phone, email and mobile synchronization tests for lead / partner. Notably * mobile is not synchronized: only a void mobile is set to partner's mobile when changing partner. It is not synchronized back onto partner; * email / phone are correctly synchronized; * phone_sanitized is computed on both lead and partner based first on mobile then on phone. It means records having the same phone numbers could have different phone_sanitized values if mobile numbers differ; Task ID-2461308 PR odoo/odoo#66890
Diffstat (limited to 'addons/crm/tests/common.py')
-rw-r--r--addons/crm/tests/common.py34
1 files changed, 29 insertions, 5 deletions
diff --git a/addons/crm/tests/common.py b/addons/crm/tests/common.py
index 5e8e18251d4..cc880bad7ca 100644
--- a/addons/crm/tests/common.py
+++ b/addons/crm/tests/common.py
@@ -118,9 +118,32 @@ class TestCrmCommon(TestSalesCommon, MailCase):
cls.lead_team_1_lost.action_set_lost()
(cls.lead_team_1_won | cls.lead_team_1_lost).flush()
+ # email / phone data
+ cls.test_email_data = [
+ '"Planet Express" <planet.express@test.example.com>',
+ '"Philip, J. Fry" <philip.j.fry@test.example.com>',
+ '"Turanga Leela" <turanga.leela@test.example.com>',
+ ]
+ cls.test_email_data_normalized = [
+ 'planet.express@test.example.com',
+ 'philip.j.fry@test.example.com',
+ 'turanga.leela@test.example.com',
+ ]
+ cls.test_pĥone_data = [
+ '+1 202 555 0122', # formatted US number
+ '202 555 0999', # local US number
+ '202 555 0888', # local US number
+ ]
+ cls.test_pĥone_data_sanitized = [
+ '+12025550122',
+ '+12025550999',
+ '+12025550888',
+ ]
+
+ # create some test contact and companies
cls.contact_company_1 = cls.env['res.partner'].create({
'name': 'Planet Express',
- 'email': 'planet.express@test.example.com',
+ 'email': cls.test_email_data[0],
'is_company': True,
'street': '57th Street',
'city': 'New New York',
@@ -129,8 +152,8 @@ class TestCrmCommon(TestSalesCommon, MailCase):
})
cls.contact_1 = cls.env['res.partner'].create({
'name': 'Philip J Fry',
- 'email': 'philip.j.fry@test.example.com',
- 'mobile': '+1 202 555 0122',
+ 'email': cls.test_email_data[1],
+ 'mobile': cls.test_pĥone_data[0],
'title': cls.env.ref('base.res_partner_title_mister').id,
'function': 'Delivery Boy',
'phone': False,
@@ -143,13 +166,14 @@ class TestCrmCommon(TestSalesCommon, MailCase):
})
cls.contact_2 = cls.env['res.partner'].create({
'name': 'Turanga Leela',
- 'email': 'turanga.leela@test.example.com',
+ 'email': cls.test_email_data[2],
+ 'mobile': cls.test_pĥone_data[1],
+ 'phone': cls.test_pĥone_data[2],
'parent_id': False,
'is_company': False,
'street': 'Cookieville Minimum-Security Orphanarium',
'city': 'New New York',
'country_id': cls.env.ref('base.us').id,
- 'mobile': '+1 202 555 0999',
'zip': '97648',
})