Browse Source

Port YAML tests to new fields.Phone archi

Fix bugs
pull/88/head
Alexis de Lattre 9 years ago
parent
commit
09f47031f8
  1. 4
      base_phone/fields.py
  2. 2
      crm_phone/crm_phone.py
  3. 4
      crm_phone/test/phonenum.yml

4
base_phone/fields.py

@ -94,7 +94,9 @@ def convert_all_phone_fields(self, vals, fields_to_convert):
country_code = False country_code = False
if country: if country:
country_code = country.code.upper() country_code = country.code.upper()
loc_vals[field] = convert_phone_field(loc_vals[field], country_code)
if loc_vals[field]:
loc_vals[field] = convert_phone_field(
loc_vals[field], country_code)
return loc_vals return loc_vals

2
crm_phone/crm_phone.py

@ -12,7 +12,7 @@ class CrmLead(models.Model):
phone = Phone(country_field='country_id') phone = Phone(country_field='country_id')
mobile = Phone(country_field='country_id') mobile = Phone(country_field='country_id')
phone = Phone(country_field='country_id')
fax = Phone(country_field='country_id')
phonecall_ids = fields.One2many( phonecall_ids = fields.One2many(
'crm.phonecall', 'opportunity_id', string='Phone Calls') 'crm.phonecall', 'opportunity_id', string='Phone Calls')
phonecall_count = fields.Integer( phonecall_count = fields.Integer(

4
crm_phone/test/phonenum.yml

@ -28,9 +28,9 @@
assert lead1.fax == '+33 1 45 44 42 43', 'Fax number not written in E.164 format (lead1)' assert lead1.fax == '+33 1 45 44 42 43', 'Fax number not written in E.164 format (lead1)'
lead2 = self.browse(cr, uid, ref('lead2'), context=context) lead2 = self.browse(cr, uid, ref('lead2'), context=context)
assert lead2.phone == '+41 43 123 45 67', 'Phone number not written in E.164 format (lead2)' assert lead2.phone == '+41 43 123 45 67', 'Phone number not written in E.164 format (lead2)'
self.write(cr, uid, ref('lead3'), {'phone': '0891234567'})
self.write(cr, uid, ref('lead3'), {'phone': '08912345678'})
lead3 = self.browse(cr, uid, ref('lead3'), context=context) lead3 = self.browse(cr, uid, ref('lead3'), context=context)
assert lead3.phone == '+49891234567', 'Phone number not written in E.164 format (lead3)'
assert lead3.phone == '+49 89 12345678', 'Phone number not written in E.164 format (lead3)'
- -
Get name from phone number Get name from phone number
- -

Loading…
Cancel
Save