From 25f00cf7e981d61b4627af4e0b50ccbaca0aa56c Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sat, 24 Jan 2015 12:53:35 +0100 Subject: [PATCH] One possible implementation of raise when partner create/write is manual vs no raise with partner create/write is via code --- base_phone/base_phone.py | 5 +++-- base_phone/res_partner_view.xml | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) 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} + +