From 07ce2c6daee4c9b3a93ef12d8336b32737b9a04b Mon Sep 17 00:00:00 2001 From: Ronald Portier Date: Wed, 2 Dec 2020 16:25:13 +0100 Subject: [PATCH] [FIX] account_lock_to_date. Exception from wizard. Also use ValidationError instead of UserError in wizard to set lock to dates. --- account_lock_to_date/wizards/account_update_lock_to_date.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/account_lock_to_date/wizards/account_update_lock_to_date.py b/account_lock_to_date/wizards/account_update_lock_to_date.py index 4e0cb063d..4f89c3802 100644 --- a/account_lock_to_date/wizards/account_update_lock_to_date.py +++ b/account_lock_to_date/wizards/account_update_lock_to_date.py @@ -1,8 +1,8 @@ # Copyright 2019 ForgeFlow S.L. -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import SUPERUSER_ID, _, api, fields, models -from odoo.exceptions import UserError +from odoo.exceptions import ValidationError class AccountUpdateLockToDate(models.TransientModel): @@ -45,7 +45,7 @@ class AccountUpdateLockToDate(models.TransientModel): self.ensure_one() has_adviser_group = self.env.user.has_group("account.group_account_manager") if not (has_adviser_group or self.env.uid == SUPERUSER_ID): - raise UserError(_("You are not allowed to execute this action.")) + raise ValidationError(_("You are not allowed to execute this action.")) def execute(self): self.ensure_one()