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

[18.0][MIG] document_page_access_group: Migration to 18.0 #523

Open
wants to merge 15 commits into
base: 18.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
97 changes: 97 additions & 0 deletions document_page_access_group/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
==========================
Document Page Access Group
==========================

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

.. |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%2Fknowledge-lightgray.png?logo=github
:target: https://github.com/OCA/knowledge/tree/18.0/document_page_access_group
:alt: OCA/knowledge
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/knowledge-18-0/knowledge-18-0-document_page_access_group
: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/knowledge&target_branch=18.0
:alt: Try me on Runboat

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

This module allows to select which users groups have access to the
document pages.

**Table of contents**

.. contents::
:local:

Usage
=====

To select the users that have access to a given document page you need
to open a document, go to the 'Security' tab and you have 3 options:

- Select a group: Only users with those groups will be able to see the
page.
- Select any user: Only the selected users will be able to see the page.
- Do not select group or user: All users will be able to see the page.

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

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

* Sygel

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

- Manuel Regidor <[email protected]>
- Alberto Martínez <[email protected]>

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

- Víctor Martínez

- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__

- Bhavesh Heliconia

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.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions document_page_access_group/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2022 Manuel Regidor <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
19 changes: 19 additions & 0 deletions document_page_access_group/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2022 Manuel Regidor <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Document Page Access Group",
"summary": "Choose groups to access document pages",
"version": "18.0.1.0.0",
"category": "document_knowledge",
"website": "https://github.com/OCA/knowledge",
"author": "Sygel, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"document_page",
"document_knowledge",
],
"data": ["views/document_page.xml", "security/security.xml"],
}
47 changes: 47 additions & 0 deletions document_page_access_group/i18n/ca.po
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:
# * document_page_access_group
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-09-04 18:06+0000\n"
"Last-Translator: Esteve Blanch Sanmartí <[email protected]."
"github.com>\n"
"Language-Team: none\n"
"Language: ca\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 5.6.2\n"

#. module: document_page_access_group
#: model:ir.model,name:document_page_access_group.model_document_page
msgid "Document Page"
msgstr "Pàgina del document"

#. module: document_page_access_group
#: model:ir.model.fields,field_description:document_page_access_group.field_document_page__groups_id
#: model_terms:ir.ui.view,arch_db:document_page_access_group.document_page_access_group_view_wiki_form
msgid "Groups"
msgstr "Grups"

#. module: document_page_access_group
#: model_terms:ir.ui.view,arch_db:document_page_access_group.document_page_access_group_view_wiki_form
msgid "Security"
msgstr "Seguretat"

#. module: document_page_access_group
#: model:ir.model.fields,field_description:document_page_access_group.field_document_page__user_ids
#: model_terms:ir.ui.view,arch_db:document_page_access_group.document_page_access_group_view_wiki_form
msgid "Users"
msgstr "Usuaris"

#. module: document_page_access_group
#. odoo-python
#: code:addons/document_page_access_group/models/document_page.py:0
#, python-format
msgid "You cannot set groups and users at the same time."
msgstr "No podeu establir grups i usuaris al mateix temps."
43 changes: 43 additions & 0 deletions document_page_access_group/i18n/document_page_access_group.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * document_page_access_group
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.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: document_page_access_group
#: model:ir.model,name:document_page_access_group.model_document_page
msgid "Document Page"
msgstr ""

#. module: document_page_access_group
#: model:ir.model.fields,field_description:document_page_access_group.field_document_page__groups_id
#: model_terms:ir.ui.view,arch_db:document_page_access_group.document_page_access_group_view_wiki_form
msgid "Groups"
msgstr ""

#. module: document_page_access_group
#: model_terms:ir.ui.view,arch_db:document_page_access_group.document_page_access_group_view_wiki_form
msgid "Security"
msgstr ""

#. module: document_page_access_group
#: model:ir.model.fields,field_description:document_page_access_group.field_document_page__user_ids
#: model_terms:ir.ui.view,arch_db:document_page_access_group.document_page_access_group_view_wiki_form
msgid "Users"
msgstr ""

#. module: document_page_access_group
#. odoo-python
#: code:addons/document_page_access_group/models/document_page.py:0
#, python-format
msgid "You cannot set groups and users at the same time."
msgstr ""
47 changes: 47 additions & 0 deletions document_page_access_group/i18n/es.po
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:
# * document_page_access_group
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-24 07:09+0000\n"
"PO-Revision-Date: 2024-07-24 09:10+0200\n"
"Last-Translator: luis-ron <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Poedit 3.0.1\n"

#. module: document_page_access_group
#: model:ir.model,name:document_page_access_group.model_document_page
msgid "Document Page"
msgstr "Página de documento"

#. module: document_page_access_group
#: model:ir.model.fields,field_description:document_page_access_group.field_document_page__groups_id
#: model_terms:ir.ui.view,arch_db:document_page_access_group.document_page_access_group_view_wiki_form
msgid "Groups"
msgstr "Grupos"

#. module: document_page_access_group
#: model_terms:ir.ui.view,arch_db:document_page_access_group.document_page_access_group_view_wiki_form
msgid "Security"
msgstr "Seguridad"

#. module: document_page_access_group
#: model:ir.model.fields,field_description:document_page_access_group.field_document_page__user_ids
#: model_terms:ir.ui.view,arch_db:document_page_access_group.document_page_access_group_view_wiki_form
msgid "Users"
msgstr "Usuarios"

#. module: document_page_access_group
#. odoo-python
#: code:addons/document_page_access_group/models/document_page.py:0
#, python-format
msgid "You cannot set groups and users at the same time."
msgstr "No puedes definir grupos y usuarios al mismo tiempo."
55 changes: 55 additions & 0 deletions document_page_access_group/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * document_page_access_group
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-08-07 08:58+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 5.6.2\n"

#. module: document_page_access_group
#: model:ir.model,name:document_page_access_group.model_document_page
msgid "Document Page"
msgstr "Pagina documento"

#. module: document_page_access_group
#: model:ir.model.fields,field_description:document_page_access_group.field_document_page__groups_id
#: model_terms:ir.ui.view,arch_db:document_page_access_group.document_page_access_group_view_wiki_form
msgid "Groups"
msgstr "Gruppi"

#. module: document_page_access_group
#: model_terms:ir.ui.view,arch_db:document_page_access_group.document_page_access_group_view_wiki_form
msgid "Security"
msgstr "Sicurezza"

#. module: document_page_access_group
#: model:ir.model.fields,field_description:document_page_access_group.field_document_page__user_ids
#: model_terms:ir.ui.view,arch_db:document_page_access_group.document_page_access_group_view_wiki_form
msgid "Users"
msgstr "Utenti"

#. module: document_page_access_group
#. odoo-python
#: code:addons/document_page_access_group/models/document_page.py:0
#, python-format
msgid "You cannot set groups and users at the same time."
msgstr "Non si possono impostare gruppi e utenti allo stesso tempo."

#~ msgid "Display Name"
#~ msgstr "Nome visualizzato"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Ultima modifica il"
4 changes: 4 additions & 0 deletions document_page_access_group/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2022 Manuel Regidor <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import document_page
21 changes: 21 additions & 0 deletions document_page_access_group/models/document_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2022 Manuel Regidor <[email protected]>
# Copyright 2024 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models
from odoo.exceptions import UserError


class DocumentPage(models.Model):
_inherit = "document.page"

groups_id = fields.Many2many(comodel_name="res.groups", string="Groups")
user_ids = fields.Many2many(comodel_name="res.users", string="Users")

@api.constrains("groups_id", "user_ids")
def check_document_page_groups_users(self):
for _item in self.filtered(lambda x: x.groups_id and x.user_ids):
raise UserError(
self.env._("You cannot set groups and users at the same time.")
)
return True
3 changes: 3 additions & 0 deletions document_page_access_group/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
7 changes: 7 additions & 0 deletions document_page_access_group/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- Manuel Regidor \<<[email protected]>\>
- Alberto Martínez \<<[email protected]>\>
* `Tecnativa <https://www.tecnativa.com>`_:

* Víctor Martínez
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
- Bhavesh Heliconia
2 changes: 2 additions & 0 deletions document_page_access_group/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows to select which users groups have access to the
document pages.
5 changes: 5 additions & 0 deletions document_page_access_group/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To select the users that have access to a given document page
you need to open a document, go to the 'Security' tab and you have 3 options:
- Select a group: Only users with those groups will be able to see the page.
- Select any user: Only the selected users will be able to see the page.
- Do not select group or user: All users will be able to see the page.
27 changes: 27 additions & 0 deletions document_page_access_group/security/security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2022 Manuel Regidor <[email protected]>
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo noupdate="1">
<record id="document_page_rule" model="ir.rule">
<field name="name">Document Page Access</field>
<field name="model_id" ref="model_document_page" />
<field eval="False" name="global" />
<field
name="groups"
eval="[Command.link(ref('document_knowledge.group_document_user'))]"
/>
<field
name="domain_force"
>['|', ('groups_id', 'in', [g.id for g in user.groups_id]), '|', ('user_ids', 'in', [user.id]), '&amp;', ('groups_id', '=', False), ('user_ids', '=', False)]</field>
</record>
<record id="document_page_rule_full_access" model="ir.rule">
<field name="name">Document Page Full Access</field>
<field name="model_id" ref="model_document_page" />
<field eval="False" name="global" />
<field
name="groups"
eval="[Command.link(ref('document_page.group_document_manager'))]"
/>
<field name="domain_force">[(1, '=', 1)]</field>
</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