Browse Source

Fix union and inc vers number

pull/1598/head
hparfr 6 years ago
parent
commit
f2cd517434
  1. 2
      base_exception/__manifest__.py
  2. 4
      base_exception/models/base_exception.py

2
base_exception/__manifest__.py

@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{'name': 'Exception Rule', {'name': 'Exception Rule',
'version': '10.0.3.0.0',
'version': '10.0.3.0.1',
'category': 'Generic Modules', 'category': 'Generic Modules',
'summary': """This module provide an abstract model to manage customizable 'summary': """This module provide an abstract model to manage customizable
exceptions to be applied on different models (sale order, invoice, ...)""", exceptions to be applied on different models (sale order, invoice, ...)""",

4
base_exception/models/base_exception.py

@ -89,7 +89,7 @@ class BaseExceptionMethod(models.AbstractModel):
def detect_exceptions(self): def detect_exceptions(self):
"""List all exception_ids applied on self """List all exception_ids applied on self
Exception ids are also written on records 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( rules = self.env['exception.rule'].sudo().search(
self._rule_domain()) self._rule_domain())
@ -98,7 +98,7 @@ class BaseExceptionMethod(models.AbstractModel):
records_with_exception = self._detect_exceptions(rule) records_with_exception = self._detect_exceptions(rule)
reverse_field = self._reverse_field() reverse_field = self._reverse_field()
if self: if self:
commons = self and rule[reverse_field]
commons = self & rule[reverse_field]
to_remove = commons - records_with_exception to_remove = commons - records_with_exception
to_add = records_with_exception - commons to_add = records_with_exception - commons
to_remove_list = [(3, x.id, _) for x in to_remove] to_remove_list = [(3, x.id, _) for x in to_remove]

Loading…
Cancel
Save