|
@ -17,9 +17,9 @@ class TestPhone(TransactionCase): |
|
|
'mobile': '06.42.77.42.66', |
|
|
'mobile': '06.42.77.42.66', |
|
|
'fax': '(0) 1 45 42 12 42', |
|
|
'fax': '(0) 1 45 42 12 42', |
|
|
}) |
|
|
}) |
|
|
self.assertEquals(partner1.phone, '+33 4 72 08 87 32') |
|
|
|
|
|
self.assertEquals(partner1.mobile, '+33 6 42 77 42 66') |
|
|
|
|
|
self.assertEquals(partner1.fax, '+33 1 45 42 12 42') |
|
|
|
|
|
|
|
|
self.assertEquals(partner1.phone, u'+33 4 72 08 87 32') |
|
|
|
|
|
self.assertEquals(partner1.mobile, u'+33 6 42 77 42 66') |
|
|
|
|
|
self.assertEquals(partner1.fax, u'+33 1 45 42 12 42') |
|
|
# Create a partner with country |
|
|
# Create a partner with country |
|
|
self.env.ref('base.res_partner_12').country_id =\ |
|
|
self.env.ref('base.res_partner_12').country_id =\ |
|
|
self.env.ref('base.ch').id |
|
|
self.env.ref('base.ch').id |
|
@ -31,22 +31,22 @@ class TestPhone(TransactionCase): |
|
|
'mobile': '(0) 79 606 42 42', |
|
|
'mobile': '(0) 79 606 42 42', |
|
|
}) |
|
|
}) |
|
|
self.assertEquals(partner2.country_id, self.env.ref('base.ch')) |
|
|
self.assertEquals(partner2.country_id, self.env.ref('base.ch')) |
|
|
self.assertEquals(partner2.phone, '+41 21 619 10 10') |
|
|
|
|
|
self.assertEquals(partner2.mobile, '+41 79 606 42 42') |
|
|
|
|
|
|
|
|
self.assertEquals(partner2.phone, u'+41 21 619 10 10') |
|
|
|
|
|
self.assertEquals(partner2.mobile, u'+41 79 606 42 42') |
|
|
# Write on an existing partner |
|
|
# Write on an existing partner |
|
|
agrolait = self.env.ref('base.res_partner_2') |
|
|
agrolait = self.env.ref('base.res_partner_2') |
|
|
self.assertEquals(agrolait.country_id, self.env.ref('base.be')) |
|
|
self.assertEquals(agrolait.country_id, self.env.ref('base.be')) |
|
|
agrolait.write({'phone': '(0) 2 391 43 74'}) |
|
|
agrolait.write({'phone': '(0) 2 391 43 74'}) |
|
|
self.assertEquals(agrolait.phone, '+32 2 391 43 74') |
|
|
|
|
|
|
|
|
self.assertEquals(agrolait.phone, u'+32 2 391 43 74') |
|
|
# Write on an existing partner with country at the same time |
|
|
# Write on an existing partner with country at the same time |
|
|
agrolait.write({ |
|
|
agrolait.write({ |
|
|
'fax': '04 72 89 32 43', |
|
|
'fax': '04 72 89 32 43', |
|
|
'country_id': self.env.ref('base.fr').id, |
|
|
'country_id': self.env.ref('base.fr').id, |
|
|
}) |
|
|
}) |
|
|
self.assertEquals(agrolait.fax, '+33 4 72 89 32 43') |
|
|
|
|
|
|
|
|
self.assertEquals(agrolait.fax, u'+33 4 72 89 32 43') |
|
|
# Write an invalid phone number |
|
|
# Write an invalid phone number |
|
|
partner2.fax = '42' |
|
|
partner2.fax = '42' |
|
|
self.assertEquals(partner2.fax, '42') |
|
|
|
|
|
|
|
|
self.assertEquals(partner2.fax, u'42') |
|
|
# Test get_name_from_phone_number |
|
|
# Test get_name_from_phone_number |
|
|
pco = self.env['phone.common'] |
|
|
pco = self.env['phone.common'] |
|
|
name = pco.get_name_from_phone_number('0642774266') |
|
|
name = pco.get_name_from_phone_number('0642774266') |
|
|