Skip to content
Extraits de code Groupes Projets
Valider 5edeca06 rédigé par Rémi - Le Filament's avatar Rémi - Le Filament
Parcourir les fichiers

[ADD] acess error

parent 8da810bd
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -2,8 +2,8 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from datetime import date
from odoo import api, fields, models
from odoo.exceptions import ValidationError
from odoo import _, api, fields, models
from odoo.exceptions import AccessError, ValidationError
class AccOperation(models.Model):
......@@ -59,12 +59,15 @@ class AccOperation(models.Model):
call from user, for manual perimeter
"""
self.ensure_one()
# Manage access rights
if self.env.user.has_group("oacc.group_operation_superadmin"):
log_id = self._perimeter()
# sudo is necessary here since admin is not allowed to create periods
elif self.env.user.has_group("oacc.group_operation_admin"):
log_id = self.sudo()._perimeter()
else:
return False
return AccessError(_("You are not allowed to call perimeter API"))
view_id = self.env.ref("oacc.acc_logs_form").id
return {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter