mirror of https://github.com/OCA/social.git
[MIG] mail_activity_team: Migration to 16.0
parent
8cb985bc13
commit
16d524d4a3
|
@ -14,13 +14,13 @@ Mail Activity Team
|
||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
|
||||||
:target: https://github.com/OCA/social/tree/15.0/mail_activity_team
|
:target: https://github.com/OCA/social/tree/16.0/mail_activity_team
|
||||||
:alt: OCA/social
|
:alt: OCA/social
|
||||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
:target: https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_activity_team
|
:target: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_activity_team
|
||||||
:alt: Translate me on Weblate
|
:alt: Translate me on Weblate
|
||||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||||
:target: https://runbot.odoo-community.org/runbot/205/15.0
|
:target: https://runbot.odoo-community.org/runbot/205/16.0
|
||||||
:alt: Try me on Runbot
|
:alt: Try me on Runbot
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
@ -58,18 +58,13 @@ You can report on the activities assigned to a team going to
|
||||||
*Dashboards / Activities*, and then filter by a specific team or group by
|
*Dashboards / Activities*, and then filter by a specific team or group by
|
||||||
teams.
|
teams.
|
||||||
|
|
||||||
Known issues / Roadmap
|
|
||||||
======================
|
|
||||||
|
|
||||||
* In next version systray.esm.js file should be changed as added in comments.
|
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
|
||||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||||
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_activity_team%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_activity_team%0Aversion:%2016.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.
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
|
@ -94,6 +89,9 @@ Contributors
|
||||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||||
|
|
||||||
* David Vidal
|
* David Vidal
|
||||||
|
* `Dynapps <https://www.dynapps.eu>`_:
|
||||||
|
|
||||||
|
* Raf Ven
|
||||||
|
|
||||||
Maintainers
|
Maintainers
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
@ -108,6 +106,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.
|
promote its widespread use.
|
||||||
|
|
||||||
This module is part of the `OCA/social <https://github.com/OCA/social/tree/15.0/mail_activity_team>`_ project on GitHub.
|
This module is part of the `OCA/social <https://github.com/OCA/social/tree/16.0/mail_activity_team>`_ project on GitHub.
|
||||||
|
|
||||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
{
|
{
|
||||||
"name": "Mail Activity Team",
|
"name": "Mail Activity Team",
|
||||||
"summary": "Add Teams to Activities",
|
"summary": "Add Teams to Activities",
|
||||||
"version": "15.0.2.1.0",
|
"version": "16.0.1.0.0",
|
||||||
"development_status": "Alpha",
|
"development_status": "Alpha",
|
||||||
"category": "Social Network",
|
"category": "Social Network",
|
||||||
"website": "https://github.com/OCA/social",
|
"website": "https://github.com/OCA/social",
|
||||||
|
@ -23,10 +23,8 @@
|
||||||
],
|
],
|
||||||
"assets": {
|
"assets": {
|
||||||
"web.assets_backend": [
|
"web.assets_backend": [
|
||||||
"mail_activity_team/static/src/js/systray.esm.js",
|
"mail_activity_team/static/src/components/*/*",
|
||||||
],
|
"mail_activity_team/static/src/models/*",
|
||||||
"web.assets_qweb": [
|
|
||||||
"mail_activity_team/static/src/xml/systray.xml",
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 15.0\n"
|
"Project-Id-Version: Odoo Server 16.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
|
@ -113,8 +113,8 @@ msgid "Missing Activities"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: mail_activity_team
|
#. module: mail_activity_team
|
||||||
#. openerp-web
|
#. odoo-javascript
|
||||||
#: code:addons/mail_activity_team/static/src/xml/systray.xml:0
|
#: code:addons/mail_activity_team/static/src/components/activity_menu_view/activity_menu_view.xml:0
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "My Activities"
|
msgid "My Activities"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -141,8 +141,8 @@ msgid "Team"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: mail_activity_team
|
#. module: mail_activity_team
|
||||||
#. openerp-web
|
#. odoo-javascript
|
||||||
#: code:addons/mail_activity_team/static/src/xml/systray.xml:0
|
#: code:addons/mail_activity_team/static/src/components/activity_menu_view/activity_menu_view.xml:0
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Team Activities"
|
msgid "Team Activities"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -168,6 +168,7 @@ msgid "Team:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: mail_activity_team
|
#. module: mail_activity_team
|
||||||
|
#. odoo-python
|
||||||
#: code:addons/mail_activity_team/models/mail_activity.py:0
|
#: code:addons/mail_activity_team/models/mail_activity.py:0
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -180,18 +181,12 @@ msgid "Used models"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: mail_activity_team
|
#. module: mail_activity_team
|
||||||
|
#: model:ir.model,name:mail_activity_team.model_res_users
|
||||||
#: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity__user_id
|
#: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity__user_id
|
||||||
msgid "User"
|
msgid "User"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: mail_activity_team
|
#. module: mail_activity_team
|
||||||
#: model:ir.model,name:mail_activity_team.model_res_users
|
|
||||||
msgid "Users"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#. module: mail_activity_team
|
|
||||||
#: model:ir.model.fields,field_description:mail_activity_team.field_event_event__activity_team_user_ids
|
|
||||||
#: model:ir.model.fields,field_description:mail_activity_team.field_event_registration__activity_team_user_ids
|
|
||||||
#: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity_mixin__activity_team_user_ids
|
#: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity_mixin__activity_team_user_ids
|
||||||
#: model:ir.model.fields,field_description:mail_activity_team.field_mailing_mailing__activity_team_user_ids
|
#: model:ir.model.fields,field_description:mail_activity_team.field_mailing_mailing__activity_team_user_ids
|
||||||
#: model:ir.model.fields,field_description:mail_activity_team.field_res_partner__activity_team_user_ids
|
#: model:ir.model.fields,field_description:mail_activity_team.field_res_partner__activity_team_user_ids
|
||||||
|
|
|
@ -78,7 +78,7 @@ class MailActivity(models.Model):
|
||||||
|
|
||||||
@api.onchange("activity_type_id")
|
@api.onchange("activity_type_id")
|
||||||
def _onchange_activity_type_id(self):
|
def _onchange_activity_type_id(self):
|
||||||
res = super(MailActivity, self)._onchange_activity_type_id()
|
res = super()._onchange_activity_type_id()
|
||||||
if self.activity_type_id.default_team_id:
|
if self.activity_type_id.default_team_id:
|
||||||
self.team_id = self.activity_type_id.default_team_id
|
self.team_id = self.activity_type_id.default_team_id
|
||||||
members = self.activity_type_id.default_team_id.member_ids
|
members = self.activity_type_id.default_team_id.member_ids
|
||||||
|
|
|
@ -20,16 +20,28 @@ class MailActivityMixin(models.AbstractModel):
|
||||||
|
|
||||||
def _search_my_activity_date_deadline(self, operator, operand):
|
def _search_my_activity_date_deadline(self, operator, operand):
|
||||||
if not self._context.get("team_activities", False):
|
if not self._context.get("team_activities", False):
|
||||||
return super(MailActivityMixin, self)._search_my_activity_date_deadline(
|
return super()._search_my_activity_date_deadline(operator, operand)
|
||||||
operator, operand
|
query = """
|
||||||
|
SELECT res_users_id
|
||||||
|
FROM mail_activity_team_users_rel
|
||||||
|
WHERE mail_activity_team_id IN (
|
||||||
|
SELECT mail_activity_team_id
|
||||||
|
FROM mail_activity_team_users_rel
|
||||||
|
WHERE res_users_id = %(user_id)s)
|
||||||
|
"""
|
||||||
|
user = self.env.uid
|
||||||
|
self.env.cr.execute(
|
||||||
|
query,
|
||||||
|
{
|
||||||
|
"user_id": user,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
users = [row[0] for row in self.env.cr.fetchall()]
|
||||||
activity_ids = self.env["mail.activity"]._search(
|
activity_ids = self.env["mail.activity"]._search(
|
||||||
[
|
[
|
||||||
"|",
|
|
||||||
("user_id", "=", self.env.user.id),
|
|
||||||
"&",
|
|
||||||
("date_deadline", operator, operand),
|
("date_deadline", operator, operand),
|
||||||
("res_model", "=", self._name),
|
("res_model", "=", self._name),
|
||||||
|
("user_id", "in", users),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
return [("activity_ids", "in", activity_ids)]
|
return [("activity_ids", "in", activity_ids)]
|
||||||
|
|
|
@ -49,13 +49,14 @@ class ResUsers(models.Model):
|
||||||
user_activities = {}
|
user_activities = {}
|
||||||
for activity in activity_data:
|
for activity in activity_data:
|
||||||
if not user_activities.get(activity["model"]):
|
if not user_activities.get(activity["model"]):
|
||||||
|
module = self.env[activity["model"]]._original_module
|
||||||
|
icon = module and modules.module.get_module_icon(module)
|
||||||
user_activities[activity["model"]] = {
|
user_activities[activity["model"]] = {
|
||||||
|
"id": activity["id"],
|
||||||
"name": model_names[activity["id"]],
|
"name": model_names[activity["id"]],
|
||||||
"model": activity["model"],
|
"model": activity["model"],
|
||||||
"type": "activity",
|
"type": "activity",
|
||||||
"icon": modules.module.get_module_icon(
|
"icon": icon,
|
||||||
self.env[activity["model"]]._original_module
|
|
||||||
),
|
|
||||||
"total_count": 0,
|
"total_count": 0,
|
||||||
"today_count": 0,
|
"today_count": 0,
|
||||||
"overdue_count": 0,
|
"overdue_count": 0,
|
||||||
|
|
|
@ -7,3 +7,6 @@
|
||||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||||
|
|
||||||
* David Vidal
|
* David Vidal
|
||||||
|
* `Dynapps <https://www.dynapps.eu>`_:
|
||||||
|
|
||||||
|
* Raf Ven
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
* In next version systray.esm.js file should be changed as added in comments.
|
|
|
@ -367,7 +367,7 @@ ul.auto-toc {
|
||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! changes will be overwritten. !!
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external" 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" href="https://github.com/OCA/social/tree/15.0/mail_activity_team"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_activity_team"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/205/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external" 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" href="https://github.com/OCA/social/tree/16.0/mail_activity_team"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_activity_team"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/205/16.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||||
<p>This module adds the possibility to assign teams to activities.</p>
|
<p>This module adds the possibility to assign teams to activities.</p>
|
||||||
<div class="admonition important">
|
<div class="admonition important">
|
||||||
<p class="first admonition-title">Important</p>
|
<p class="first admonition-title">Important</p>
|
||||||
|
@ -379,12 +379,11 @@ Only for development or testing purpose, do not use in production.
|
||||||
<div class="contents local topic" id="contents">
|
<div class="contents local topic" id="contents">
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
|
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
|
||||||
<li><a class="reference internal" href="#known-issues-roadmap" id="id2">Known issues / Roadmap</a></li>
|
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
|
||||||
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
|
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
|
||||||
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
|
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
|
||||||
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
|
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
|
||||||
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
|
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
|
||||||
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -407,31 +406,25 @@ assigned team.</p>
|
||||||
<em>Dashboards / Activities</em>, and then filter by a specific team or group by
|
<em>Dashboards / Activities</em>, and then filter by a specific team or group by
|
||||||
teams.</p>
|
teams.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="known-issues-roadmap">
|
|
||||||
<h1><a class="toc-backref" href="#id2">Known issues / Roadmap</a></h1>
|
|
||||||
<ul class="simple">
|
|
||||||
<li>In next version systray.esm.js file should be changed as added in comments.</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="section" id="bug-tracker">
|
<div class="section" id="bug-tracker">
|
||||||
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
|
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
|
||||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||||
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_activity_team%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_activity_team%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="credits">
|
<div class="section" id="credits">
|
||||||
<h1><a class="toc-backref" href="#id4">Credits</a></h1>
|
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
|
||||||
<div class="section" id="authors">
|
<div class="section" id="authors">
|
||||||
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
|
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>ForgeFlow</li>
|
<li>ForgeFlow</li>
|
||||||
<li>Sodexis</li>
|
<li>Sodexis</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="contributors">
|
<div class="section" id="contributors">
|
||||||
<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
|
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><a class="reference external" href="https://www.forgeflow.com">ForgeFlow</a>:<ul>
|
<li><a class="reference external" href="https://www.forgeflow.com">ForgeFlow</a>:<ul>
|
||||||
<li>Jordi Ballester Alomar (<a class="reference external" href="mailto:jordi.ballester@forgeflow.com">jordi.ballester@forgeflow.com</a>)</li>
|
<li>Jordi Ballester Alomar (<a class="reference external" href="mailto:jordi.ballester@forgeflow.com">jordi.ballester@forgeflow.com</a>)</li>
|
||||||
|
@ -444,16 +437,20 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||||
<li>David Vidal</li>
|
<li>David Vidal</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a class="reference external" href="https://www.dynapps.eu">Dynapps</a>:<ul>
|
||||||
|
<li>Raf Ven</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="maintainers">
|
<div class="section" id="maintainers">
|
||||||
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
|
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
|
||||||
<p>This module is maintained by the OCA.</p>
|
<p>This module is maintained by the OCA.</p>
|
||||||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.</p>
|
promote its widespread use.</p>
|
||||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/15.0/mail_activity_team">OCA/social</a> project on GitHub.</p>
|
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/16.0/mail_activity_team">OCA/social</a> project on GitHub.</p>
|
||||||
<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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<templates>
|
||||||
|
<t
|
||||||
|
t-name="ActivityMenuView"
|
||||||
|
t-inherit="mail.ActivityMenuView"
|
||||||
|
t-inherit-mode="extension"
|
||||||
|
owl="1"
|
||||||
|
>
|
||||||
|
<xpath
|
||||||
|
expr="//div[hasclass('o_ActivityMenuView_activityGroups')]"
|
||||||
|
position="before"
|
||||||
|
>
|
||||||
|
<div class="o_mail_systray_dropdown_top">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a
|
||||||
|
class="my_activities o_filter_nav_item nav-link active"
|
||||||
|
data-filter='my'
|
||||||
|
t-on-click="activityMenuView.onClickActivityFilter"
|
||||||
|
>
|
||||||
|
My Activities
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a
|
||||||
|
class="team_activities o_filter_nav_item nav-link"
|
||||||
|
data-filter='team'
|
||||||
|
t-on-click="activityMenuView.onClickActivityFilter"
|
||||||
|
>
|
||||||
|
Team Activities
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
</templates>
|
|
@ -1,110 +0,0 @@
|
||||||
/** @odoo-module **/
|
|
||||||
import ActivityMenu from "@mail/js/systray/systray_activity_menu";
|
|
||||||
import {session} from "@web/session";
|
|
||||||
|
|
||||||
ActivityMenu.include({
|
|
||||||
events: _.extend({}, ActivityMenu.prototype.events, {
|
|
||||||
"click .o_filter_button": "_onClickFilterButton",
|
|
||||||
}),
|
|
||||||
start: function () {
|
|
||||||
this._super.apply(this, arguments);
|
|
||||||
this.$filter_buttons = this.$(".o_filter_button");
|
|
||||||
this.$my_activities = this.$filter_buttons.first();
|
|
||||||
this.filter = "my";
|
|
||||||
this._update_team_activities_context();
|
|
||||||
},
|
|
||||||
|
|
||||||
_update_team_activities_context: function () {
|
|
||||||
session.user_context.team_activities = this.filter === "team";
|
|
||||||
},
|
|
||||||
|
|
||||||
_updateCounter: function () {
|
|
||||||
this._super.apply(this, arguments);
|
|
||||||
this.$(".o_notification_counter").text(this.activityCounter);
|
|
||||||
},
|
|
||||||
|
|
||||||
_onClickFilterButton: function (event) {
|
|
||||||
event.stopPropagation();
|
|
||||||
this.$filter_buttons.removeClass("active");
|
|
||||||
var $target = $(event.currentTarget);
|
|
||||||
$target.addClass("active");
|
|
||||||
this.filter = $target.data("filter");
|
|
||||||
this._update_team_activities_context();
|
|
||||||
this._updateActivityPreview();
|
|
||||||
},
|
|
||||||
_onActivityFilterClick: function (event) {
|
|
||||||
if (this.filter === "my") {
|
|
||||||
this._super.apply(this, arguments);
|
|
||||||
}
|
|
||||||
if (this.filter === "team") {
|
|
||||||
var data = _.extend(
|
|
||||||
{},
|
|
||||||
$(event.currentTarget).data(),
|
|
||||||
$(event.target).data()
|
|
||||||
);
|
|
||||||
var context = {};
|
|
||||||
context.team_activities = 1;
|
|
||||||
if (data.filter === "my") {
|
|
||||||
context.search_default_activities_overdue = 1;
|
|
||||||
context.search_default_activities_today = 1;
|
|
||||||
} else {
|
|
||||||
context["search_default_activities_" + data.filter] = 1;
|
|
||||||
}
|
|
||||||
this.do_action({
|
|
||||||
type: "ir.actions.act_window",
|
|
||||||
name: data.model_name,
|
|
||||||
res_model: data.res_model,
|
|
||||||
views: [
|
|
||||||
[false, "kanban"],
|
|
||||||
[false, "form"],
|
|
||||||
],
|
|
||||||
search_view_id: [false],
|
|
||||||
domain: [["activity_team_user_ids", "in", [session.uid]]],
|
|
||||||
context: context,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_open_boards_activities_domain: function () {
|
|
||||||
if (this.filter === "team") {
|
|
||||||
return {additional_context: {search_default_my_team_activities: 1}};
|
|
||||||
}
|
|
||||||
return this._super.apply(this, arguments);
|
|
||||||
},
|
|
||||||
_getActivityData: function () {
|
|
||||||
if (this.filter !== "team") {
|
|
||||||
return this._super.apply(this, arguments);
|
|
||||||
}
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
return self
|
|
||||||
._rpc({
|
|
||||||
model: "res.users",
|
|
||||||
method: "systray_get_activities",
|
|
||||||
args: [],
|
|
||||||
kwargs: {context: session.user_context},
|
|
||||||
})
|
|
||||||
.then(function (data) {
|
|
||||||
self._activities = data;
|
|
||||||
self.activityCounter = _.reduce(
|
|
||||||
data,
|
|
||||||
function (total_count, p_data) {
|
|
||||||
return total_count + p_data.total_count || 0;
|
|
||||||
},
|
|
||||||
0
|
|
||||||
);
|
|
||||||
self.$(".o_notification_counter").text(self.activityCounter);
|
|
||||||
self.$el.toggleClass("o_no_notification", !self.activityCounter);
|
|
||||||
// Unset context after we gather the info to avoid side effects
|
|
||||||
session.user_context.team_activities = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
_onActivityMenuHide: function () {
|
|
||||||
this.filter = "my";
|
|
||||||
this._update_team_activities_context();
|
|
||||||
this._getActivityData();
|
|
||||||
this.$filter_buttons.removeClass("active");
|
|
||||||
var $target = $(".my_activities");
|
|
||||||
$target.addClass("active");
|
|
||||||
return this._super.apply(this, arguments);
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
/** @odoo-module **/
|
||||||
|
|
||||||
|
import {registerPatch} from "@mail/model/model_core";
|
||||||
|
import session from "web.session";
|
||||||
|
|
||||||
|
registerPatch({
|
||||||
|
name: "ActivityGroupView",
|
||||||
|
recordMethods: {
|
||||||
|
onClickFilterButton(ev) {
|
||||||
|
const _super = this._super.bind(this);
|
||||||
|
if (this.activityMenuViewOwner.currentFilter === "my") {
|
||||||
|
return _super(ev);
|
||||||
|
}
|
||||||
|
if (this.activityMenuViewOwner.currentFilter === "team") {
|
||||||
|
this.activityMenuViewOwner.close();
|
||||||
|
const data = _.extend(
|
||||||
|
{},
|
||||||
|
$(ev.currentTarget).data(),
|
||||||
|
$(ev.target).data()
|
||||||
|
);
|
||||||
|
const context = {};
|
||||||
|
if (data.filter === "my") {
|
||||||
|
context.search_default_activities_overdue = 1;
|
||||||
|
context.search_default_activities_today = 1;
|
||||||
|
} else {
|
||||||
|
context["search_default_activities_" + data.filter] = 1;
|
||||||
|
}
|
||||||
|
context.team_activities = true;
|
||||||
|
// Necessary because activity_ids of mail.activity.mixin has auto_join
|
||||||
|
// So, duplicates are faking the count and "Load more" doesn't show up
|
||||||
|
context.force_search_count = 1;
|
||||||
|
let domain = [["activity_team_user_ids", "in", [session.uid]]];
|
||||||
|
if (data.domain) {
|
||||||
|
domain = domain.concat(data.domain);
|
||||||
|
}
|
||||||
|
this.env.services.action.doAction(
|
||||||
|
{
|
||||||
|
context,
|
||||||
|
domain,
|
||||||
|
name: data.model_name,
|
||||||
|
res_model: data.res_model,
|
||||||
|
search_view_id: [false],
|
||||||
|
type: "ir.actions.act_window",
|
||||||
|
views: this.activityGroup.irModel.availableWebViews.map(
|
||||||
|
(viewName) => [false, viewName]
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
clearBreadcrumbs: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
|
@ -0,0 +1,68 @@
|
||||||
|
/** @odoo-module **/
|
||||||
|
|
||||||
|
import {attr} from "@mail/model/model_field";
|
||||||
|
import {registerPatch} from "@mail/model/model_core";
|
||||||
|
import session from "web.session";
|
||||||
|
|
||||||
|
registerPatch({
|
||||||
|
name: "ActivityMenuView",
|
||||||
|
fields: {
|
||||||
|
currentFilter: attr({
|
||||||
|
default: "my",
|
||||||
|
}),
|
||||||
|
isTeamActive: attr({
|
||||||
|
default: false,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
recordMethods: {
|
||||||
|
close() {
|
||||||
|
const _super = this._super.bind(this);
|
||||||
|
this.activateFilter($(".my_activities"));
|
||||||
|
return _super();
|
||||||
|
},
|
||||||
|
onClickDropdownToggle(ev) {
|
||||||
|
const _super = this._super.bind(this);
|
||||||
|
this.activateFilter($(".my_activities"));
|
||||||
|
return _super(ev);
|
||||||
|
},
|
||||||
|
deactivateButtons() {
|
||||||
|
$(".o_filter_nav_item").removeClass("active");
|
||||||
|
},
|
||||||
|
updateTeamActivitiesContext() {
|
||||||
|
this.update({isTeamActive: this.currentFilter === "team"});
|
||||||
|
},
|
||||||
|
activateFilter(filter) {
|
||||||
|
this.deactivateButtons();
|
||||||
|
filter.addClass("active");
|
||||||
|
this.update({currentFilter: filter.data("filter")});
|
||||||
|
this.updateTeamActivitiesContext();
|
||||||
|
this.fetchData();
|
||||||
|
},
|
||||||
|
onClickActivityFilter(event) {
|
||||||
|
event.stopPropagation();
|
||||||
|
this.activateFilter($(event.currentTarget));
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
*/
|
||||||
|
async fetchData() {
|
||||||
|
const _super = this._super.bind(this);
|
||||||
|
if (!this.isTeamActive) {
|
||||||
|
return _super();
|
||||||
|
}
|
||||||
|
const context = _.extend({}, session.user_context, {team_activities: true});
|
||||||
|
const data = await this.messaging.rpc({
|
||||||
|
model: "res.users",
|
||||||
|
method: "systray_get_activities",
|
||||||
|
args: [],
|
||||||
|
kwargs: {context: context},
|
||||||
|
});
|
||||||
|
this.update({
|
||||||
|
activityGroups: data.map((vals) =>
|
||||||
|
this.messaging.models.ActivityGroup.convertData(vals)
|
||||||
|
),
|
||||||
|
extraCount: 0,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
|
@ -1,25 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<templates>
|
|
||||||
|
|
||||||
<t t-extend="mail.systray.ActivityMenu">
|
|
||||||
<t t-jquery=".o_mail_systray_dropdown_items" t-operation="before">
|
|
||||||
<div class="o_mail_systray_dropdown_top">
|
|
||||||
<div>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="my_activities btn btn-link o_filter_button active"
|
|
||||||
data-filter='my'
|
|
||||||
role="tab"
|
|
||||||
> My Activities </button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="team_activities btn btn-link o_filter_button"
|
|
||||||
data-filter='team'
|
|
||||||
role="tab"
|
|
||||||
> Team Activities </button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</t>
|
|
||||||
</t>
|
|
||||||
|
|
||||||
</templates>
|
|
|
@ -114,7 +114,7 @@ class TestMailActivityTeam(TransactionCase):
|
||||||
|
|
||||||
def test_activity_members(self):
|
def test_activity_members(self):
|
||||||
self.team1.member_ids |= self.employee2
|
self.team1.member_ids |= self.employee2
|
||||||
self.partner_client.refresh()
|
self.partner_client.invalidate_recordset()
|
||||||
self.assertIn(self.employee2, self.partner_client.activity_team_user_ids)
|
self.assertIn(self.employee2, self.partner_client.activity_team_user_ids)
|
||||||
self.assertIn(self.employee, self.partner_client.activity_team_user_ids)
|
self.assertIn(self.employee, self.partner_client.activity_team_user_ids)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -155,9 +155,11 @@ class TestMailActivityTeam(TransactionCase):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.act2.team_id, self.team1, "Error: Activity 2 should have Team 1."
|
self.act2.team_id, self.team1, "Error: Activity 2 should have Team 1."
|
||||||
)
|
)
|
||||||
|
with self.assertRaises(
|
||||||
|
AssertionError, msg="can't write on invisible field user_id"
|
||||||
|
):
|
||||||
with Form(self.act2) as form:
|
with Form(self.act2) as form:
|
||||||
form.user_id = self.employee2
|
form.user_id = self.employee2
|
||||||
self.assertEqual(form.team_id, self.team2)
|
|
||||||
|
|
||||||
def test_activity_onchanges_user_no_team(self):
|
def test_activity_onchanges_user_no_team(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -269,7 +271,7 @@ class TestMailActivityTeam(TransactionCase):
|
||||||
activity = partner_record.activity_schedule(
|
activity = partner_record.activity_schedule(
|
||||||
activity_type_id=self.activity2.id, user_id=self.employee2.id
|
activity_type_id=self.activity2.id, user_id=self.employee2.id
|
||||||
)
|
)
|
||||||
activity.flush()
|
activity.flush_recordset()
|
||||||
res = (
|
res = (
|
||||||
self.env["res.users"]
|
self.env["res.users"]
|
||||||
.with_user(self.employee.id)
|
.with_user(self.employee.id)
|
||||||
|
@ -292,7 +294,7 @@ class TestMailActivityTeam(TransactionCase):
|
||||||
self.team2.member_ids = self.employee2
|
self.team2.member_ids = self.employee2
|
||||||
partner_record = self.employee.partner_id.with_user(self.employee.id)
|
partner_record = self.employee.partner_id.with_user(self.employee.id)
|
||||||
activity = partner_record.activity_schedule(activity_type_id=self.activity1.id)
|
activity = partner_record.activity_schedule(activity_type_id=self.activity1.id)
|
||||||
activity.flush()
|
activity.flush_recordset()
|
||||||
_messages, next_activities = activity._action_done()
|
_messages, next_activities = activity._action_done()
|
||||||
self.assertTrue(next_activities)
|
self.assertTrue(next_activities)
|
||||||
self.assertEqual(next_activities.team_id, self.team2)
|
self.assertEqual(next_activities.team_id, self.team2)
|
||||||
|
|
Loading…
Reference in New Issue