diff --git a/openerp/models.py b/openerp/models.py index c72bdd1a0ea..83a212096ac 100644 --- a/openerp/models.py +++ b/openerp/models.py @@ -1199,8 +1199,11 @@ class BaseModel(object): type = 'warning' if isinstance(exception, Warning) else 'error' # logs the logical (not human-readable) field name for automated # processing of response, but injects human readable in message - record = dict(base, type=type, field=field, - message=unicode(exception.args[0]) % base) + # Before applying string substitution, we need to escape all '%' + # characters that are not part of substitutable reference. + regex = '%%(?!\((%s)\)s)' % '|'.join(base.keys()) + message = unicode(re.sub(regex, '%%', exception.args[0])) % base + record = dict(base, type=type, field=field, message=message) if len(exception.args) > 1 and exception.args[1]: record.update(exception.args[1]) log(record)