From 1d314962fe53f6be1cd9cc2e9a777b7e6723163e Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Fri, 4 Sep 2015 16:57:10 +0200 Subject: [PATCH] [FIX] models: handle the case of `_constraints` with empty list of field names --- openerp/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openerp/models.py b/openerp/models.py index 38d4423f3e7..0071370164c 100644 --- a/openerp/models.py +++ b/openerp/models.py @@ -1247,7 +1247,8 @@ class BaseModel(object): for fun, msg, names in self._constraints: try: # validation must be context-independent; call ``fun`` without context - valid = not (set(names) & field_names) or fun(self._model, cr, uid, ids) + valid = names and not (set(names) & field_names) + valid = valid or fun(self._model, cr, uid, ids) extra_error = None except Exception, e: _logger.debug('Exception while validating constraint', exc_info=True)