From d9ce012d297e61dfa8c32c4cd7b77ebb634c090d Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 27 May 2014 11:39:32 +0200 Subject: [PATCH] [IMP] simplify handling of callable _constraint message --- openerp/osv/orm.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 86ce76cb6f9..76b4d7ee3ff 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -1562,12 +1562,9 @@ class BaseModel(object): # Check presence of __call__ directly instead of using # callable() because it will be deprecated as of Python 3.0 if hasattr(msg, '__call__'): - tmp_msg = msg(self, cr, uid, ids, context=context) - if isinstance(tmp_msg, tuple): - tmp_msg, params = tmp_msg - translated_msg = tmp_msg % params - else: - translated_msg = tmp_msg + translated_msg = msg(self, cr, uid, ids, context=context) + if isinstance(translated_msg, tuple): + translated_msg = translated_msg[0] % translated_msg[1] else: translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, msg) if extra_error: