diff --git a/base_phone/base_phone.py b/base_phone/base_phone.py index 6b9b789..e2f71db 100644 --- a/base_phone/base_phone.py +++ b/base_phone/base_phone.py @@ -61,9 +61,10 @@ class phone_common(orm.AbstractModel): return result def _generic_reformat_phonenumbers(self, cr, uid, vals, phonefields=None, - raise_if_parse_fails=False, context=None): """Reformat phone numbers in E.164 format i.e. +33141981242""" + if context is None: + context = {} if phonefields is None: phonefields = [ 'phone', 'partner_phone', 'work_phone', 'fax', @@ -105,7 +106,7 @@ class phone_common(orm.AbstractModel): _logger.error( "Cannot reformat the phone number '%s' to " "international format" % vals.get(field)) - if raise_if_parse_fails: + if context.get('raise_if_phone_parse_fails'): raise orm.except_orm( _('Error:'), _("Cannot reformat the phone number '%s' to " diff --git a/base_phone/res_partner_view.xml b/base_phone/res_partner_view.xml index fdc1996..28bf5e5 100644 --- a/base_phone/res_partner_view.xml +++ b/base_phone/res_partner_view.xml @@ -56,5 +56,9 @@ + + {'search_default_customer':1, 'raise_if_phone_parse_fails': True} + +