Browse Source

[FIX] Prevent error msg in test with context hack

pull/68/head
Stefan Rijnhart 9 years ago
parent
commit
7a50b2eff9
  1. 10
      base_phone/base_phone.py
  2. 2
      base_phone/test/phonenum.yml

10
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 "

2
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
-

Loading…
Cancel
Save