Skip to content

Commit 6035b02

Browse files
committed
[ADD]project_portal_task_visibility: show task only to followers
1 parent e14e452 commit 6035b02

File tree

11 files changed

+583
-1
lines changed

11 files changed

+583
-1
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
==============================
2+
Project Portal Task Visibility
3+
==============================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:f99d765df67d100615deb52080825e2dbb618f1b4c9067d10a10dae2f9e3c662
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github
20+
:target: https://github.com/OCA/project/tree/16.0/project_portal_task_visibility
21+
:alt: OCA/project
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_portal_task_visibility
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/project&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module changes behavior of task visibility.
32+
With this module, portal users will only see task where they are explicitly set as follower.
33+
So visibility on project only is no longer enough.
34+
However, when creating a new task, all users following the project will automatically follow the new task too.
35+
36+
**Table of contents**
37+
38+
.. contents::
39+
:local:
40+
41+
Bug Tracker
42+
===========
43+
44+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/project/issues>`_.
45+
In case of trouble, please check there if your issue has already been reported.
46+
If you spotted it first, help us to smash it by providing a detailed and welcomed
47+
`feedback <https://github.com/OCA/project/issues/new?body=module:%20project_portal_task_visibility%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
48+
49+
Do not contact contributors directly about support or help with technical issues.
50+
51+
Credits
52+
=======
53+
54+
Authors
55+
~~~~~~~
56+
57+
* PyTech SRL
58+
59+
Contributors
60+
~~~~~~~~~~~~
61+
62+
* `PyTech <https://pytech.it>`_:
63+
64+
* Quirino Leone <[email protected]>
65+
* Alessandro Uffreduzzi <[email protected]>
66+
67+
Maintainers
68+
~~~~~~~~~~~
69+
70+
This module is maintained by the OCA.
71+
72+
.. image:: https://odoo-community.org/logo.png
73+
:alt: Odoo Community Association
74+
:target: https://odoo-community.org
75+
76+
OCA, or the Odoo Community Association, is a nonprofit organization whose
77+
mission is to support the collaborative development of Odoo features and
78+
promote its widespread use.
79+
80+
This module is part of the `OCA/project <https://github.com/OCA/project/tree/16.0/project_portal_task_visibility>`_ project on GitHub.
81+
82+
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 .hooks import post_init_hook, uninstall_hook
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "Project Portal Task Visibility",
3+
"version": "16.0.1.0.0",
4+
"depends": [
5+
"project",
6+
"portal",
7+
],
8+
"website": "https://github.com/OCA/project",
9+
"author": "PyTech SRL, Odoo Community Association (OCA)",
10+
"category": "Project",
11+
"license": "AGPL-3",
12+
"data": ["security/project_portal_task_visibility.xml"],
13+
"installable": True,
14+
"application": False,
15+
"post_init_hook": "post_init_hook",
16+
"uninstall_hook": "uninstall_hook",
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import logging
2+
3+
from odoo import SUPERUSER_ID, api
4+
5+
_logger = logging.getLogger(__name__)
6+
7+
8+
def post_init_hook(cr, registry):
9+
env = api.Environment(cr, SUPERUSER_ID, {})
10+
_logger.info("Turning off rule")
11+
env.ref("project.project_task_rule_portal").write({"active": False})
12+
13+
14+
def uninstall_hook(cr, registry):
15+
env = api.Environment(cr, SUPERUSER_ID, {})
16+
_logger.info("Turning on rule")
17+
env.ref("project.project_task_rule_portal").write({"active": True})
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
* `PyTech <https://pytech.it>`_:
2+
3+
* Quirino Leone <[email protected]>
4+
* Alessandro Uffreduzzi <[email protected]>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This module changes behavior of task visibility.
2+
With this module, portal users will only see task where they are explicitly set as follower.
3+
So visibility on project only is no longer enough.
4+
However, when creating a new task, all users following the project will automatically follow the new task too.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo>
3+
<record id="project_portal_task_visibility" model="ir.rule">
4+
<field name="name">Project/Task: portal users: portal and following task</field>
5+
<field name="model_id" ref="project.model_project_task" />
6+
<field name="domain_force">[
7+
('project_id.privacy_visibility', '=', 'portal'),
8+
('active', '=', True),
9+
('message_partner_ids', 'child_of', [user.partner_id.commercial_partner_id.id]),
10+
]</field>
11+
<field name="perm_read" eval="True" />
12+
<field name="perm_write" eval="False" />
13+
<field name="perm_create" eval="False" />
14+
<field name="perm_unlink" eval="False" />
15+
<field name="groups" eval="[(4, ref('base.group_portal'))]" />
16+
</record>
17+
</odoo>

0 commit comments

Comments
 (0)