From f593cdab18c4700af5d4e04a0aa7c6b367488f70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 11 May 2021 14:35:12 +0000 Subject: [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) --- addons/crm/tests/test_crm_lead.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'addons/crm') 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({ -- cgit v1.2.3