Browse Source

Merge PR #1732 into 12.0

Signed-off-by StefanRijnhart
12.0-mig-module_prototyper_last
OCA-git-bot 5 years ago
parent
commit
04b6ee5be3
  1. 12
      base_exception/models/base_exception.py
  2. 2
      base_exception/tests/test_base_exception.py

12
base_exception/models/base_exception.py

@ -101,12 +101,12 @@ class BaseExceptionMethod(models.AbstractModel):
to_remove = commons - records_with_exception to_remove = commons - records_with_exception
to_add = records_with_exception - commons to_add = records_with_exception - commons
# we expect to always work on the same model type # we expect to always work on the same model type
rules_to_remove.setdefault(
rule.id, main_records.browse()
).update(to_remove)
rules_to_add.setdefault(
rule.id, main_records.browse()
).update(to_add)
if rule.id not in rules_to_remove:
rules_to_remove[rule.id] = main_records.browse()
rules_to_remove[rule.id] |= to_remove
if rule.id not in rules_to_add:
rules_to_add[rule.id] = main_records.browse()
rules_to_add[rule.id] |= to_add
if records_with_exception: if records_with_exception:
all_exception_ids.append(rule.id) all_exception_ids.append(rule.id)
# Cumulate all the records to attach to the rule # Cumulate all the records to attach to the rule

2
base_exception/tests/test_base_exception.py

@ -68,6 +68,8 @@ class TestBaseException(common.SavepointCase):
# Block because of exception during validation # Block because of exception during validation
with self.assertRaises(ValidationError): with self.assertRaises(ValidationError):
potest1.button_confirm() potest1.button_confirm()
# Test that we have linked exceptions
self.assertTrue(potest1.exception_ids)
# Test ignore exeception make possible for the po to validate # Test ignore exeception make possible for the po to validate
potest1.ignore_exception = True potest1.ignore_exception = True
potest1.button_confirm() potest1.button_confirm()

Loading…
Cancel
Save