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.
 
 
 
 
 

50 lines
1.9 KiB

-
Write country = FR for the main company
-
!record {model: res.company, id: base.main_company}:
country_id: base.fr
-
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 == '+33 6 42 77 42 66', 'Mobile number not written in E.164 format (partner1)'
assert partner1.fax == '+33 1 45 42 12 42', 'Fax number not written in E.164 format (partner1)'
partner2 = self.browse(cr, uid, ref('partner2'), context=context)
assert partner2.phone == '+41 21 619 10 10', 'Phone number not written in E.164 format (partner2)'
assert partner2.mobile == '+41 79 606 42 42', '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)'