From 35d196b7dd2248af990a575a0df370e79c880ff5 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Fri, 9 Jun 2017 14:09:08 +0200 Subject: [PATCH] [FIX] base_exception: '_check_exception' is 'api.multi' since it's called by constraint methods 'detect_exception' can be called on an empty recordset. --- base_exception/models/base_exception.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/base_exception/models/base_exception.py b/base_exception/models/base_exception.py index 2c72f694c..c7922cbfe 100644 --- a/base_exception/models/base_exception.py +++ b/base_exception/models/base_exception.py @@ -108,7 +108,7 @@ class BaseException(models.AbstractModel): action = self.env.ref('base_exception.action_exception_rule_confirm') return action - @api.model + @api.multi def _check_exception(self): """ This method must be used in a constraint that must be created in the @@ -138,6 +138,8 @@ class BaseException(models.AbstractModel): def detect_exceptions(self): """returns the list of exception_ids for all the considered base.exceptions """ + if not self: + return [] exception_obj = self.env['exception.rule'] all_exceptions = exception_obj.sudo().search( [('rule_group', '=', self[0].rule_group)])