[FIX] account_lock_to_date. Exception from wizard.

Also use ValidationError instead of UserError in wizard to set lock to dates.
This commit is contained in:
Ronald Portier
2020-12-02 16:25:13 +01:00
committed by Simone Rubino
parent 1eda8a362a
commit b9406d4aaa
3 changed files with 5 additions and 5 deletions

View File

@@ -5,7 +5,7 @@
"name": "Account Lock To Date",
"summary": """
Allows to set an account lock date in the future.""",
"version": "13.0.1.0.0",
"version": "13.0.1.0.1",
"license": "AGPL-3",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools",

View File

@@ -181,5 +181,5 @@ msgstr ""
#, python-format
msgid ""
"You cannot lock a period that is not finished yet. Please make sure that the"
" lock date for advisors is not set after the last day of the previous month."
" lock date for advisors is set at or after the last day of the next month."
msgstr ""

View File

@@ -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()