Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] project_administrator_restricted_visibility: Migration to 17.0 #1291

Open
wants to merge 12 commits into
base: 17.0
Choose a base branch
from
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
113 changes: 113 additions & 0 deletions project_administrator_restricted_visibility/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
===========================================
Project Administrator Restricted Visibility
===========================================

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

.. |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/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github
:target: https://github.com/OCA/project/tree/17.0/project_administrator_restricted_visibility
:alt: OCA/project
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/project-17-0/project-17-0-project_administrator_restricted_visibility
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/project&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module extends the functionality of 'Project' module to add a new
'Project Administrator' access group with restricted visibility to the
projects.

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you need to:

1. Go to *Settings > Users & Companies > Users*
2. Create a user or edit an existing one.
3. A new access group called 'Restricted Project Administrator' under
the 'Projects' category can be selected.

Usage
=====

The new group has the same access rights as the administrator (and see
the same menus), but the project visibility is restricted as a project
user.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/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/OCA/project/issues/new?body=module:%20project_administrator_restricted_visibility%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
-------

* Tecnativa

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

- `Tecnativa <https://www.tecnativa.com>`__:

- Ernesto Tejeda
- Pilar Vargas

- `Moduon <https://www.moduon.team>`__:

- Eduardo López

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

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-rafaelbn| image:: https://github.com/rafaelbn.png?size=40px
:target: https://github.com/rafaelbn
:alt: rafaelbn
.. |maintainer-edlopen| image:: https://github.com/edlopen.png?size=40px
:target: https://github.com/edlopen
:alt: edlopen

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-rafaelbn| |maintainer-edlopen|

This module is part of the `OCA/project <https://github.com/OCA/project/tree/17.0/project_administrator_restricted_visibility>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions project_administrator_restricted_visibility/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .hooks import uninstall_hook
14 changes: 14 additions & 0 deletions project_administrator_restricted_visibility/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Project Administrator Restricted Visibility",
"version": "17.0.1.0.0",
"summary": "Adds a 'Project Administrator' access group "
"with restricted visibility to 'Projects'",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/project",
"license": "AGPL-3",
"category": "Project",
"depends": ["project"],
"data": ["security/project_security.xml"],
"uninstall_hook": "uninstall_hook",
"maintainers": ["rafaelbn", "edlopen"],
}
27 changes: 27 additions & 0 deletions project_administrator_restricted_visibility/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2023 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import SUPERUSER_ID, api


def uninstall_hook(cr, registry):
"""Restore project.project_project_manager_rule"""
env = api.Environment(cr, SUPERUSER_ID, {})
# Removing the 'group_full_project_manager' group before renaming the original
# 'Project: Administrator' group (project.group_project_manager) to 'Administrator'
# in order to avoid getting a SQL constraint error:
# 'duplicate key value violates unique constraint "res_groups_name_uniq'"
group_full_project_manager = env.ref(
"project_administrator_restricted_visibility.group_full_project_manager"
)
env.ref("project.project_project_manager_rule").write(
{"groups": [(3, group_full_project_manager.id)]}
)
group_full_project_manager.unlink()
# Rename the original 'Project: Administrator' access group back to 'Administrator'
# and reassign the access rule for projects that it previously had.
env.ref("project.group_project_manager").write(
{
"name": "Administrator",
"rule_groups": [(4, env.ref("project.project_project_manager_rule").id)],
}
)
25 changes: 25 additions & 0 deletions project_administrator_restricted_visibility/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_administrator_restricted_visibility
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-06-19 08:08+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: project_administrator_restricted_visibility
#: model:res.groups,name:project_administrator_restricted_visibility.group_full_project_manager
msgid "Full Administrator"
msgstr "Gestione completa"

#~ msgid "Administrator"
#~ msgstr "Amministratore"
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_administrator_restricted_visibility
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \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_administrator_restricted_visibility
#: model:res.groups,name:project_administrator_restricted_visibility.group_full_project_manager
msgid "Full Administrator"
msgstr ""
3 changes: 3 additions & 0 deletions project_administrator_restricted_visibility/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
To configure this module, you need to:

1. Go to *Settings \> Users & Companies \> Users*
2. Create a user or edit an existing one.
3. A new access group called 'Restricted Project Administrator' under
the 'Projects' category can be selected.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- [Tecnativa](https://www.tecnativa.com):
- Ernesto Tejeda
- Pilar Vargas
- [Moduon](https://www.moduon.team):
- Eduardo López
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module extends the functionality of 'Project' module to add a new
'Project Administrator' access group with restricted visibility to the
projects.
3 changes: 3 additions & 0 deletions project_administrator_restricted_visibility/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The new group has the same access rights as the administrator (and see
the same menus), but the project visibility is restricted as a project
user.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Rename old 'Project Administrator' access group name and unlink
the access rule for the projects -->
<record id="project.group_project_manager" model="res.groups">
<field name="name">Restricted Administrator</field>
<field
name="rule_groups"
eval="[(3, ref('project.project_project_manager_rule'))]"
/>
</record>
<!-- Create a new 'Project Administrator' access group with
the original 'Project Administrator' access rule for project -->
<record id="group_full_project_manager" model="res.groups">
<field name="name">Full Administrator</field>
<field name="category_id" ref="base.module_category_services_project" />
<field name="implied_ids" eval="[(4, ref('project.group_project_manager'))]" />
<field
name="rule_groups"
eval="[(4, ref('project.project_project_manager_rule'))]"
/>
</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
Loading