From c65ca1e0abaaea4767a894fc2d7af80816c31c99 Mon Sep 17 00:00:00 2001 From: hparfr Date: Fri, 7 Jun 2019 12:15:33 +0200 Subject: [PATCH] Fix intersection operator --- base_exception/__manifest__.py | 2 +- base_exception/models/base_exception.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/base_exception/__manifest__.py b/base_exception/__manifest__.py index a66a05727..4e93835c7 100644 --- a/base_exception/__manifest__.py +++ b/base_exception/__manifest__.py @@ -4,7 +4,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { 'name': 'Exception Rule', - 'version': '12.0.2.0.1', + 'version': '12.0.2.0.2', 'category': 'Generic Modules', 'summary': """ This module provide an abstract model to manage customizable diff --git a/base_exception/models/base_exception.py b/base_exception/models/base_exception.py index 8443f290a..79224d126 100644 --- a/base_exception/models/base_exception.py +++ b/base_exception/models/base_exception.py @@ -76,7 +76,7 @@ class BaseExceptionMethod(models.AbstractModel): def detect_exceptions(self): """List all exception_ids applied on self Exception ids are also written on records - If self is empty, check exceptions on all records. + If self is empty, check exceptions on all active records. """ rules = self.env['exception.rule'].sudo().search( self._rule_domain()) @@ -85,7 +85,7 @@ class BaseExceptionMethod(models.AbstractModel): records_with_exception = self._detect_exceptions(rule) reverse_field = self._reverse_field() if self: - commons = self and rule[reverse_field] + commons = self & rule[reverse_field] to_remove = commons - records_with_exception to_add = records_with_exception - commons to_remove_list = [(3, x.id, _) for x in to_remove]