diff --git a/base_phone/base_phone.py b/base_phone/base_phone.py index 0d663be..b63ad7c 100644 --- a/base_phone/base_phone.py +++ b/base_phone/base_phone.py @@ -103,10 +103,12 @@ class PhoneCommon(models.AbstractModel): # by a user via the Web interface # logger is usefull when the record is created/written # via the webservices - _logger.error( - "Cannot reformat the phone number '%s' to " - "international format with region=%s" - % (vals.get(field), countrycode)) + # Just don't generate this error message during testing + if not context.get('yml_test'): + _logger.error( + "Cannot reformat the phone number '%s' to " + "international format with region=%s" + % (vals.get(field), countrycode)) if context.get('raise_if_phone_parse_fails'): raise Warning( _("Cannot reformat the phone number '%s' to " diff --git a/base_phone/test/phonenum.yml b/base_phone/test/phonenum.yml index e1e320e..fb50cf8 100644 --- a/base_phone/test/phonenum.yml +++ b/base_phone/test/phonenum.yml @@ -16,7 +16,7 @@ - Write invalid phone number - - !record {model: res.partner, id: partner3}: + !record {model: res.partner, id: partner3, context: {"yml_test": True}}: name: Jean Badphone phone: 42 -