Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions project_create_restriction/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==========================
Project Create Restriction
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:dde70dd2e06c3607caf308408c696f6be6c56da4d0846bf3da2b080b3d695a2e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-solvosci%2Fslv--project-lightgray.png?logo=github
:target: https://github.com/solvosci/slv-project/tree/17.0/project_create_restriction
:alt: solvosci/slv-project

|badge1| |badge2| |badge3|

Adds an extra access control layer on projects and tasks.

A dedicated security group is introduced by this module and can be found
under the "Extra Rights" category. Only users belonging to this group
are allowed to create or delete projects and tasks.

Other users can still access and work with existing records according to
standard Odoo permissions.

This module is inspired by existing OCA security addons such as
product_readonly_security.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/solvosci/slv-project/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/solvosci/slv-project/issues/new?body=module:%20project_create_restriction%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Solvos

Contributors
------------

- Carlos García <carlos.garcia@solvos.es>

Maintainers
-----------

This module is part of the `solvosci/slv-project <https://github.com/solvosci/slv-project/tree/17.0/project_create_restriction>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions project_create_restriction/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions project_create_restriction/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# © 2026 Solvos Consultoría Informática (<http://www.solvos.es>)
# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html
{
"name": "Project Create Restriction",
"summary": """
Restrict project and task creation based on user groups
""",
"author": "Solvos",
"license": "LGPL-3",
"version": "17.0.1.0.0",
"category": "Project",
"website": "https://github.com/solvosci/slv-project",
"depends": [
"project",
],
"data": [
"security/security.xml",
],
"installable": True,
}
46 changes: 46 additions & 0 deletions project_create_restriction/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_create_restriction
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-01-19 12:56+0000\n"
"PO-Revision-Date: 2026-01-19 12:56+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: project_create_restriction
#: model:ir.model,name:project_create_restriction.model_project_project
msgid "Project"
msgstr "Proyecto"

#. module: project_create_restriction
#: model:res.groups,name:project_create_restriction.group_project_create_projects_tasks
msgid "Projects: can create projects and/or tasks"
msgstr "Proyectos: puede crear proyectos y/o tareas"

#. module: project_create_restriction
#: model:ir.model,name:project_create_restriction.model_project_task
msgid "Task"
msgstr "Tarea"

#. module: project_create_restriction
#. odoo-python
#: code:addons/project_create_restriction/models/project_task.py:0
#, python-format
msgid ""
"You are not allowed to create or delete tasks."
msgstr "No estás habilitado para crear o borrar tareas"

#. module: project_create_restriction
#. odoo-python
#: code:addons/project_create_restriction/models/project_project.py:0
#, python-format
msgid "You are not allowed to create, edit or delete projects. "
msgstr "No estás habilitado para crear, editar o eliminar proyectos"
47 changes: 47 additions & 0 deletions project_create_restriction/i18n/project_create_restriction.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_create_restriction
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-01-19 12:55+0000\n"
"PO-Revision-Date: 2026-01-19 12:55+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: project_create_restriction
#: model:ir.model,name:project_create_restriction.model_project_project
msgid "Project"
msgstr ""

#. module: project_create_restriction
#: model:res.groups,name:project_create_restriction.group_project_create_projects_tasks
msgid "Projects: can create projects and/or tasks"
msgstr ""

#. module: project_create_restriction
#: model:ir.model,name:project_create_restriction.model_project_task
msgid "Task"
msgstr ""

#. module: project_create_restriction
#. odoo-python
#: code:addons/project_create_restriction/models/project_task.py:0
#, python-format
msgid ""
"You are not allowed to create or delete tasks. Please contact your "
"administrator for further information."
msgstr ""

#. module: project_create_restriction
#. odoo-python
#: code:addons/project_create_restriction/models/project_project.py:0
#, python-format
msgid "You are not allowed to create, edit or delete projects. "
msgstr ""
2 changes: 2 additions & 0 deletions project_create_restriction/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import project_project
from . import project_task
31 changes: 31 additions & 0 deletions project_create_restriction/models/project_project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# © 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 Project(models.Model):
_inherit = "project.project"

@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 != "read"
and user != admin_user
and not user.has_group(group)
):
if raise_exception:
raise AccessError(
_(
"You are not allowed to create, edit or delete projects. "
)
)
return False

return super().check_access_rights(operation, raise_exception)

30 changes: 30 additions & 0 deletions project_create_restriction/models/project_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,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)
1 change: 1 addition & 0 deletions project_create_restriction/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Carlos García \<<carlos.garcia@solvos.es>\>
11 changes: 11 additions & 0 deletions project_create_restriction/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Adds an extra access control layer on projects and tasks.

A dedicated security group is introduced by this module and can be found
under the "Extra Rights" category. Only users belonging to this group are
allowed to create or delete projects and tasks.

Other users can still access and work with existing records according to
standard Odoo permissions.
Comment thread
dalonsod marked this conversation as resolved.

This module is inspired by existing OCA security addons such as
product_readonly_security.
9 changes: 9 additions & 0 deletions project_create_restriction/security/security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<odoo>

<record id="group_project_create_projects_tasks" model="res.groups">
<field name="name">Projects: can create projects and/or tasks</field>
<field name="category_id" ref="base.module_category_usability" />
<field name="implied_ids" eval="[(4, ref('project.group_project_manager'))]"/>
</record>

</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading