Skip to content

Commit ab1c006

Browse files
[MIG] document_page_access_group_user_role: Migration to 19.0
Migrated from 18.0 to 19.0 with all necessary Odoo 19 compatibility fixes. Tested on a live Odoo 19.0 instance. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ffb9a21 commit ab1c006

19 files changed

Lines changed: 822 additions & 0 deletions

File tree

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
5+
====================================
6+
Document Page Access Group User Role
7+
====================================
8+
9+
..
10+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11+
!! This file is generated by oca-gen-addon-readme !!
12+
!! changes will be overwritten. !!
13+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14+
!! source digest: sha256:94116a47bb3c0718e303c2056c7a8111748e80f677448f2fd96b059f8fca3311
15+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16+
17+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
18+
:target: https://odoo-community.org/page/development-status
19+
:alt: Beta
20+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
21+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
22+
:alt: License: AGPL-3
23+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github
24+
:target: https://github.com/OCA/knowledge/tree/18.0/document_page_access_group_user_role
25+
:alt: OCA/knowledge
26+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27+
:target: https://translation.odoo-community.org/projects/knowledge-18-0/knowledge-18-0-document_page_access_group_user_role
28+
:alt: Translate me on Weblate
29+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=18.0
31+
:alt: Try me on Runboat
32+
33+
|badge1| |badge2| |badge3| |badge4| |badge5|
34+
35+
Use of roles (module base_user_role) in Document Pages.
36+
37+
**Table of contents**
38+
39+
.. contents::
40+
:local:
41+
42+
Usage
43+
=====
44+
45+
1. Go to Settings / Users & Companies / Roles and create a new one.
46+
2. Go to Knowledge / Pages and create or edit one.
47+
3. Set in the "Roles" tab the one we have just created.
48+
4. Go back to the role, edit it and add any group(s).
49+
5. The role users will have been added in the "Security" tab.
50+
51+
Bug Tracker
52+
===========
53+
54+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/knowledge/issues>`_.
55+
In case of trouble, please check there if your issue has already been reported.
56+
If you spotted it first, help us to smash it by providing a detailed and welcomed
57+
`feedback <https://github.com/OCA/knowledge/issues/new?body=module:%20document_page_access_group_user_role%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
58+
59+
Do not contact contributors directly about support or help with technical issues.
60+
61+
Credits
62+
=======
63+
64+
Authors
65+
-------
66+
67+
* Tecnativa
68+
69+
Contributors
70+
------------
71+
72+
- `Tecnativa <https://www.tecnativa.com>`__:
73+
74+
- Víctor Martínez
75+
- Pedro M. Baeza
76+
77+
Maintainers
78+
-----------
79+
80+
This module is maintained by the OCA.
81+
82+
.. image:: https://odoo-community.org/logo.png
83+
:alt: Odoo Community Association
84+
:target: https://odoo-community.org
85+
86+
OCA, or the Odoo Community Association, is a nonprofit organization whose
87+
mission is to support the collaborative development of Odoo features and
88+
promote its widespread use.
89+
90+
.. |maintainer-victoralmau| image:: https://github.com/victoralmau.png?size=40px
91+
:target: https://github.com/victoralmau
92+
:alt: victoralmau
93+
94+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
95+
96+
|maintainer-victoralmau|
97+
98+
This module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/18.0/document_page_access_group_user_role>`_ project on GitHub.
99+
100+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2024 Tecnativa - Víctor Martínez
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
{
4+
"name": "Document Page Access Group User Role",
5+
"author": "Tecnativa, Odoo Community Association (OCA)",
6+
"website": "https://github.com/OCA/knowledge",
7+
"version": "19.0.1.0.0",
8+
"depends": ["document_page_access_group", "base_user_role"],
9+
"license": "AGPL-3",
10+
"category": "Knowledge",
11+
"data": [
12+
"views/document_page_views.xml",
13+
],
14+
"installable": True,
15+
"maintainers": ["victoralmau"],
16+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * document_page_access_group_user_role
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 18.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: document_page_access_group_user_role
17+
#: model:ir.model,name:document_page_access_group_user_role.model_document_page
18+
msgid "Document Page"
19+
msgstr ""
20+
21+
#. module: document_page_access_group_user_role
22+
#: model:ir.model.fields,field_description:document_page_access_group_user_role.field_document_page__role_ids
23+
#: model_terms:ir.ui.view,arch_db:document_page_access_group_user_role.document_page_access_group_view_wiki_form
24+
msgid "Roles"
25+
msgstr ""
26+
27+
#. module: document_page_access_group_user_role
28+
#: model:ir.model.fields,field_description:document_page_access_group_user_role.field_document_page__user_ids
29+
msgid "Users"
30+
msgstr ""
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * document_page_access_group_user_role
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 16.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2024-05-31 10:50+0000\n"
10+
"PO-Revision-Date: 2024-05-31 12:51+0200\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
13+
"Language: es\n"
14+
"MIME-Version: 1.0\n"
15+
"Content-Type: text/plain; charset=UTF-8\n"
16+
"Content-Transfer-Encoding: 8bit\n"
17+
"Plural-Forms: \n"
18+
"X-Generator: Poedit 3.0.1\n"
19+
20+
#. module: document_page_access_group_user_role
21+
#: model:ir.model,name:document_page_access_group_user_role.model_document_page
22+
msgid "Document Page"
23+
msgstr "Página del documento"
24+
25+
#. module: document_page_access_group_user_role
26+
#: model:ir.model.fields,field_description:document_page_access_group_user_role.field_document_page__role_ids
27+
#: model_terms:ir.ui.view,arch_db:document_page_access_group_user_role.document_page_access_group_view_wiki_form
28+
msgid "Roles"
29+
msgstr "Roles"
30+
31+
#. module: document_page_access_group_user_role
32+
#: model:ir.model.fields,field_description:document_page_access_group_user_role.field_document_page__user_ids
33+
msgid "Users"
34+
msgstr ""
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * document_page_access_group_user_role
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 16.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"PO-Revision-Date: 2024-08-12 08:58+0000\n"
10+
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
11+
"Language-Team: none\n"
12+
"Language: it\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
17+
"X-Generator: Weblate 5.6.2\n"
18+
19+
#. module: document_page_access_group_user_role
20+
#: model:ir.model,name:document_page_access_group_user_role.model_document_page
21+
msgid "Document Page"
22+
msgstr "Pagina documento"
23+
24+
#. module: document_page_access_group_user_role
25+
#: model:ir.model.fields,field_description:document_page_access_group_user_role.field_document_page__role_ids
26+
#: model_terms:ir.ui.view,arch_db:document_page_access_group_user_role.document_page_access_group_view_wiki_form
27+
msgid "Roles"
28+
msgstr "Ruoli"
29+
30+
#. module: document_page_access_group_user_role
31+
#: model:ir.model.fields,field_description:document_page_access_group_user_role.field_document_page__user_ids
32+
msgid "Users"
33+
msgstr "Utenti"
34+
35+
#~ msgid "Groups"
36+
#~ msgstr "Gruppi"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * document_page_access_group_user_role
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 16.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"PO-Revision-Date: 2025-02-04 17:11+0000\n"
10+
"Last-Translator: Peter Romão <peterromao@yahoo.co.uk>\n"
11+
"Language-Team: none\n"
12+
"Language: pt\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: nplurals=2; plural=n > 1;\n"
17+
"X-Generator: Weblate 5.6.2\n"
18+
19+
#. module: document_page_access_group_user_role
20+
#: model:ir.model,name:document_page_access_group_user_role.model_document_page
21+
msgid "Document Page"
22+
msgstr "Página do Documento"
23+
24+
#. module: document_page_access_group_user_role
25+
#: model:ir.model.fields,field_description:document_page_access_group_user_role.field_document_page__role_ids
26+
#: model_terms:ir.ui.view,arch_db:document_page_access_group_user_role.document_page_access_group_view_wiki_form
27+
msgid "Roles"
28+
msgstr "Papéis"
29+
30+
#. module: document_page_access_group_user_role
31+
#: model:ir.model.fields,field_description:document_page_access_group_user_role.field_document_page__user_ids
32+
msgid "Users"
33+
msgstr "Utilizadores"
34+
35+
#~ msgid "Groups"
36+
#~ msgstr "Grupos"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
2+
3+
from . import document_page
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2024 Tecnativa - Víctor Martínez
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import api, fields, models
5+
6+
7+
class DocumentPage(models.Model):
8+
_inherit = "document.page"
9+
10+
user_ids = fields.Many2many(compute="_compute_user_ids", store=True, readonly=False)
11+
role_ids = fields.Many2many(
12+
comodel_name="res.users.role",
13+
relation="document_page_user_roles_rel",
14+
column1="page_id",
15+
column2="role_id",
16+
string="Roles",
17+
)
18+
19+
@api.depends("role_ids", "role_ids.users")
20+
def _compute_user_ids(self):
21+
"""compute to auto-set all the users of the related roles."""
22+
for item in self:
23+
item.user_ids += item.mapped("role_ids.users")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"

0 commit comments

Comments
 (0)