-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject_task.py
More file actions
30 lines (24 loc) · 966 Bytes
/
project_task.py
File metadata and controls
30 lines (24 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# © 2026 Solvos Consultoría Informática (<http://www.solvos.es>)
# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html
from odoo import api, models, _
from odoo.exceptions import AccessError
class ProjectTask(models.Model):
_inherit = "project.task"
@api.model
def check_access_rights(self, operation, raise_exception=True):
user = self.env.user
group = "project_create_restriction.group_project_create_projects_tasks"
admin_user = self.env.ref("base.user_root")
if (
operation in ("create", "unlink")
and user != admin_user
and not user.has_group(group)
):
if raise_exception:
raise AccessError(
_(
"You are not allowed to create or delete tasks. "
)
)
return False
return super().check_access_rights(operation, raise_exception)