Skip to content

Commit

Permalink
Merge PR #1732 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by StefanRijnhart
  • Loading branch information
OCA-git-bot committed Dec 9, 2019
2 parents d3d3521 + 64136bd commit 04b6ee5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 6 additions & 6 deletions base_exception/models/base_exception.py
Expand Up @@ -101,12 +101,12 @@ def detect_exceptions(self):
to_remove = commons - records_with_exception
to_add = records_with_exception - commons
# 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:
all_exception_ids.append(rule.id)
# Cumulate all the records to attach to the rule
Expand Down
2 changes: 2 additions & 0 deletions base_exception/tests/test_base_exception.py
Expand Up @@ -68,6 +68,8 @@ def test_purchase_order_exception(self):
# Block because of exception during validation
with self.assertRaises(ValidationError):
potest1.button_confirm()
# Test that we have linked exceptions
self.assertTrue(potest1.exception_ids)
# Test ignore exeception make possible for the po to validate
potest1.ignore_exception = True
potest1.button_confirm()
Expand Down

0 comments on commit 04b6ee5

Please sign in to comment.