Skip to content

Commit 45e97b0

Browse files
[MIG] document_page_access_group: Migration to 18.0
1 parent 4649661 commit 45e97b0

File tree

10 files changed

+40
-48
lines changed

10 files changed

+40
-48
lines changed

document_page_access_group/README.rst

+17-14
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Document Page Access Group
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github
20-
:target: https://github.com/OCA/knowledge/tree/17.0/document_page_access_group
20+
:target: https://github.com/OCA/knowledge/tree/18.0/document_page_access_group
2121
:alt: OCA/knowledge
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/knowledge-17-0/knowledge-17-0-document_page_access_group
23+
:target: https://translation.odoo-community.org/projects/knowledge-18-0/knowledge-18-0-document_page_access_group
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=17.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -42,19 +42,18 @@ Usage
4242
To select the users that have access to a given document page you need
4343
to open a document, go to the 'Security' tab and you have 3 options:
4444

45-
- Select a group: Only users with those groups will be able to see the
46-
page.
47-
- Select any user: Only the selected users will be able to see the
48-
page.
49-
- Do not select group or user: All users will be able to see the page.
45+
- Select a group: Only users with those groups will be able to see the
46+
page.
47+
- Select any user: Only the selected users will be able to see the page.
48+
- Do not select group or user: All users will be able to see the page.
5049

5150
Bug Tracker
5251
===========
5352

5453
Bugs are tracked on `GitHub Issues <https://github.com/OCA/knowledge/issues>`_.
5554
In case of trouble, please check there if your issue has already been reported.
5655
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%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
56+
`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**>`_.
5857

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

@@ -69,12 +68,16 @@ Authors
6968
Contributors
7069
------------
7170

72-
- Manuel Regidor <manuel.regidor@sygel.es>
73-
- Alberto Martínez <alberto.martinez@sygel.es>
71+
- Manuel Regidor <manuel.regidor@sygel.es>
72+
- Alberto Martínez <alberto.martinez@sygel.es>
7473

75-
- ``Tecnativa <https://www.tecnativa.com>``\ \_:
74+
- ``Tecnativa <https://www.tecnativa.com>``\ \_:
7675

77-
- Víctor Martínez
76+
- Víctor Martínez
77+
78+
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__
79+
80+
- Bhavesh Heliconia
7881

7982
Maintainers
8083
-----------
@@ -89,6 +92,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
8992
mission is to support the collaborative development of Odoo features and
9093
promote its widespread use.
9194

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

9497
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

document_page_access_group/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"name": "Document Page Access Group",
66
"summary": "Choose groups to access document pages",
7-
"version": "17.0.2.0.0",
7+
"version": "18.0.1.0.0",
88
"category": "document_knowledge",
99
"website": "https://github.com/OCA/knowledge",
1010
"author": "Sygel, Odoo Community Association (OCA)",

document_page_access_group/migrations/17.0.1.1.0/noupdate_changes.xml

-8
This file was deleted.

document_page_access_group/migrations/17.0.1.1.0/post-migration.py

-12
This file was deleted.

document_page_access_group/models/document_page.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright 2024 Tecnativa - Víctor Martínez
33
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
44

5-
from odoo import _, api, fields, models
5+
from odoo import api, fields, models
66
from odoo.exceptions import UserError
77

88

@@ -15,5 +15,7 @@ class DocumentPage(models.Model):
1515
@api.constrains("groups_id", "user_ids")
1616
def check_document_page_groups_users(self):
1717
for _item in self.filtered(lambda x: x.groups_id and x.user_ids):
18-
raise UserError(_("You cannot set groups and users at the same time."))
18+
raise UserError(
19+
self.env._("You cannot set groups and users at the same time.")
20+
)
1921
return True

document_page_access_group/readme/CONTRIBUTORS.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
* `Tecnativa <https://www.tecnativa.com>`_:
44

55
* Víctor Martínez
6+
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
7+
- Bhavesh Heliconia

document_page_access_group/security/security.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<field eval="False" name="global" />
99
<field
1010
name="groups"
11-
eval="[(4, ref('document_knowledge.group_document_user'))]"
11+
eval="[Command.link(ref('document_knowledge.group_document_user'))]"
1212
/>
1313
<field
1414
name="domain_force"
@@ -20,7 +20,7 @@
2020
<field eval="False" name="global" />
2121
<field
2222
name="groups"
23-
eval="[(4, ref('document_page.group_document_manager'))]"
23+
eval="[Command.link(ref('document_page.group_document_manager'))]"
2424
/>
2525
<field name="domain_force">[(1, '=', 1)]</field>
2626
</record>

document_page_access_group/static/description/index.html

+8-5
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ <h1 class="title">Document Page Access Group</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:28e06c90139270717bf9f3fbe04145a72fed721a256eb4d526ee229beaf1cc69
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/knowledge/tree/17.0/document_page_access_group"><img alt="OCA/knowledge" src="https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/knowledge-17-0/knowledge-17-0-document_page_access_group"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/knowledge&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/knowledge/tree/18.0/document_page_access_group"><img alt="OCA/knowledge" src="https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/knowledge-18-0/knowledge-18-0-document_page_access_group"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/knowledge&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p>This module allows to select which users groups have access to the
374374
document pages.</p>
375375
<p><strong>Table of contents</strong></p>
@@ -392,8 +392,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
392392
<ul class="simple">
393393
<li>Select a group: Only users with those groups will be able to see the
394394
page.</li>
395-
<li>Select any user: Only the selected users will be able to see the
396-
page.</li>
395+
<li>Select any user: Only the selected users will be able to see the page.</li>
397396
<li>Do not select group or user: All users will be able to see the page.</li>
398397
</ul>
399398
</div>
@@ -402,7 +401,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
402401
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/knowledge/issues">GitHub Issues</a>.
403402
In case of trouble, please check there if your issue has already been reported.
404403
If you spotted it first, help us to smash it by providing a detailed and welcomed
405-
<a class="reference external" href="https://github.com/OCA/knowledge/issues/new?body=module:%20document_page_access_group%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
404+
<a class="reference external" href="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**">feedback</a>.</p>
406405
<p>Do not contact contributors directly about support or help with technical issues.</p>
407406
</div>
408407
<div class="section" id="credits">
@@ -422,6 +421,10 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
422421
<li>Víctor Martínez</li>
423422
</ul>
424423
</li>
424+
<li><a class="reference external" href="https://www.heliconia.io">Heliconia Solutions Pvt. Ltd.</a><ul>
425+
<li>Bhavesh Heliconia</li>
426+
</ul>
427+
</li>
425428
</ul>
426429
</div>
427430
<div class="section" id="maintainers">
@@ -433,7 +436,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
433436
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
434437
mission is to support the collaborative development of Odoo features and
435438
promote its widespread use.</p>
436-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/17.0/document_page_access_group">OCA/knowledge</a> project on GitHub.</p>
439+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/18.0/document_page_access_group">OCA/knowledge</a> project on GitHub.</p>
437440
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
438441
</div>
439442
</div>

document_page_access_group/tests/common.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
2+
from odoo import Command
23
from odoo.tests import new_test_user
34

45
from odoo.addons.base.tests.common import BaseCommon
@@ -17,21 +18,21 @@ def setUpClass(cls):
1718
login="test-manager-user",
1819
groups="document_knowledge.group_document_user",
1920
)
20-
cls.manager_user.write({"groups_id": [(4, cls.group.id)]})
21+
cls.manager_user.write({"groups_id": [Command.link(cls.group.id)]})
2122
cls.public_page = cls.env["document.page"].create(
2223
{"name": "Public Page", "type": "content"}
2324
)
2425
cls.knowledge_page = cls.env["document.page"].create(
2526
{
2627
"name": "Knowledge Page",
2728
"type": "content",
28-
"groups_id": [(6, 0, [cls.group.id])],
29+
"groups_id": [Command.set([cls.group.id])],
2930
}
3031
)
3132
cls.user_page = cls.env["document.page"].create(
3233
{
3334
"name": "User Page (basic user)",
3435
"type": "content",
35-
"user_ids": [(6, 0, [cls.user.id])],
36+
"user_ids": [Command.set([cls.user.id])],
3637
}
3738
)

document_page_access_group/tests/test_document_page_access_group.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
2+
from odoo import Command
23
from odoo.exceptions import UserError
34
from odoo.tests.common import users
45

@@ -8,7 +9,7 @@
89
class TestDocumentPageAccessGroup(TestDocumentPageAccessGroupBase):
910
def test_page_access_constrains(self):
1011
with self.assertRaises(UserError):
11-
self.knowledge_page.write({"user_ids": [(6, 0, [self.user.id])]})
12+
self.knowledge_page.write({"user_ids": [Command.set([self.user.id])]})
1213

1314
@users("test-user")
1415
def test_page_access_01(self):

0 commit comments

Comments
 (0)