You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.8 KiB
45 lines
1.8 KiB
-
|
|
Write french phone numbers in national format
|
|
-
|
|
!record {model: res.partner, id: partner1}:
|
|
name: Pierre Paillet
|
|
mobile: 06 42 77 42 66
|
|
fax: (0) 1 45 42 12 42
|
|
-
|
|
Write swiss phone numbers in international format
|
|
-
|
|
!record {model: res.partner, id: partner2}:
|
|
name: Joël Grand-Guillaume
|
|
parent_id: base.res_partner_12
|
|
phone: +41 21 619 10 10
|
|
mobile: +41 79 606 42 42
|
|
-
|
|
Write invalid phone number
|
|
-
|
|
!record {model: res.partner, id: partner3}:
|
|
name: Jean Badphone
|
|
phone: 42
|
|
-
|
|
Check that valid phone numbers have been converted to E.164
|
|
-
|
|
!python {model: res.partner}: |
|
|
partner1 = self.browse(cr, uid, ref('partner1'), context=context)
|
|
assert partner1.mobile == '+33642774266', 'Mobile number not written in E.164 format (partner1)'
|
|
assert partner1.fax == '+33145421242', 'Fax number not written in E.164 format (partner1)'
|
|
partner2 = self.browse(cr, uid, ref('partner2'), context=context)
|
|
assert partner2.phone == '+41216191010', 'Phone number not written in E.164 format (partner2)'
|
|
assert partner2.mobile == '+41796064242', 'Mobile number not written in E.164 format (partner2)'
|
|
-
|
|
Check that invalid phone numbers are kept unchanged
|
|
-
|
|
!python {model: res.partner}: |
|
|
partner3 = self.browse(cr, uid, ref('partner3'), context=context)
|
|
assert partner3.phone == '42', 'Invalid phone numbers should not be changed'
|
|
-
|
|
Get name from phone number
|
|
-
|
|
!python {model: phone.common}: |
|
|
name = self.get_name_from_phone_number(cr, uid, '0642774266')
|
|
assert name == 'Pierre Paillet', 'Wrong result for get_name_from_phone_number'
|
|
name2 = self.get_name_from_phone_number(cr, uid, '0041216191010')
|
|
assert name2 == u'Joël Grand-Guillaume (Camptocamp)', 'Wrong result for get_name_from_phone_number (partner2)'
|