|
@ -44,6 +44,7 @@ def format( |
|
|
if self.pool.get('base.phone.installed') and phone and text: |
|
|
if self.pool.get('base.phone.installed') and phone and text: |
|
|
# text should already be in E164 format, so we don't have |
|
|
# text should already be in E164 format, so we don't have |
|
|
# to give a country code to phonenumbers.parse() |
|
|
# to give a country code to phonenumbers.parse() |
|
|
|
|
|
try: |
|
|
phone_number = phonenumbers.parse(text) |
|
|
phone_number = phonenumbers.parse(text) |
|
|
if phone_format == 'international': |
|
|
if phone_format == 'international': |
|
|
res = phonenumbers.format_number( |
|
|
res = phonenumbers.format_number( |
|
@ -56,6 +57,8 @@ def format( |
|
|
phone_number, phonenumbers.PhoneNumberFormat.E164) |
|
|
phone_number, phonenumbers.PhoneNumberFormat.E164) |
|
|
else: |
|
|
else: |
|
|
res = text |
|
|
res = text |
|
|
|
|
|
except: |
|
|
|
|
|
res = text |
|
|
else: |
|
|
else: |
|
|
res = format_original(self, text, oldtag=oldtag) |
|
|
res = format_original(self, text, oldtag=oldtag) |
|
|
return res |
|
|
return res |
|
|