diff --git a/base_exception/__manifest__.py b/base_exception/__manifest__.py index 7d3a49458b9..19bed159796 100644 --- a/base_exception/__manifest__.py +++ b/base_exception/__manifest__.py @@ -5,7 +5,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Exception Rule", - "version": "18.0.1.1.1", + "version": "18.0.1.1.2", "development_status": "Mature", "category": "Generic Modules", "summary": """ diff --git a/base_exception/tests/test_base_exception.py b/base_exception/tests/test_base_exception.py index 2c869160a90..5ab59d592b6 100644 --- a/base_exception/tests/test_base_exception.py +++ b/base_exception/tests/test_base_exception.py @@ -141,6 +141,13 @@ def test_blocking_exception(self): with self.assertRaises(UserError): self.po.action_ignore_exceptions() self.assertFalse(self.po.ignore_exception) + # The confirmation wizard must enforce the same blocking check, even + # when a downstream wizard sets ``ignore_exception`` directly. + self.exception_rule_confirm.exception_ids = self.po.exception_ids + self.exception_rule_confirm.ignore = True + with self.assertRaises(UserError): + self.exception_rule_confirm.action_confirm() + self.assertFalse(self.po.ignore_exception) with self.assertRaises(ValidationError): self.po.button_confirm() self.po.with_context(raise_exception=False).button_confirm() diff --git a/base_exception/wizard/base_exception_confirm.py b/base_exception/wizard/base_exception_confirm.py index 60f4dc04f33..9c7ea7d5f72 100644 --- a/base_exception/wizard/base_exception_confirm.py +++ b/base_exception/wizard/base_exception_confirm.py @@ -4,7 +4,7 @@ # Copyright 2020 Hibou Corp. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import _, api, fields, models -from odoo.exceptions import ValidationError +from odoo.exceptions import UserError, ValidationError class ExceptionRuleConfirm(models.AbstractModel): @@ -34,4 +34,13 @@ def default_get(self, field_list): def action_confirm(self): self.ensure_one() + if self.ignore: + if any(self.exception_ids.mapped("is_blocking")): + raise UserError( + _( + "The exceptions can not be ignored, because " + "some of them are blocking." + ) + ) + self.related_model_id.action_ignore_exceptions() return {"type": "ir.actions.act_window_close"}