summaryrefslogtreecommitdiff
path: root/addons/crm
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2021-05-11 14:35:12 +0000
committerThibault Delavallée <tde@odoo.com>2021-05-11 14:35:14 +0000
commitf593cdab18c4700af5d4e04a0aa7c6b367488f70 (patch)
treee78a1d9a7dad07a7e355af79b56074fbe62c5790 /addons/crm
parent4b0c551194e8ef66df9136629afe71566ffe212e (diff)
[FIX] phone_validation: add country trigger on sanitize phone computation
If country is updated on a record inheriting from mail.thread.phone its sanitized number should be computed again. Indeed without this trigger it is not computed and may lead to inconsistencies between phone numbers and sanitized number. Task ID-2528169 closes odoo/odoo#70684 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/crm')
-rw-r--r--addons/crm/tests/test_crm_lead.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/addons/crm/tests/test_crm_lead.py b/addons/crm/tests/test_crm_lead.py
index 54df5adf79f..b1c2716674f 100644
--- a/addons/crm/tests/test_crm_lead.py
+++ b/addons/crm/tests/test_crm_lead.py
@@ -408,6 +408,12 @@ class TestCRMLead(TestCrmCommon):
self.assertEqual(lead.mobile, self.test_phone_data[2])
self.assertEqual(lead.phone_sanitized, self.test_phone_data_sanitized[2])
+ # updating country should trigger sanitize computation
+ lead.write({'country_id': self.env.ref('base.be').id})
+ self.assertEqual(lead.phone, self.test_phone_data[1])
+ self.assertEqual(lead.mobile, self.test_phone_data[2])
+ self.assertFalse(lead.phone_sanitized)
+
@users('user_sales_manager')
def test_phone_mobile_search(self):
lead_1 = self.env['crm.lead'].create({