[MIG] mail_activity_team: Migration to 15.0

pull/1321/head
Bernat Puig Font 2022-01-17 12:45:08 +01:00 committed by sonhd91
parent e4ab8408f7
commit 7e6c9176e0
14 changed files with 183 additions and 185 deletions

View File

@ -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/14.0/mail_activity_team :target: https://github.com/OCA/social/tree/15.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-14-0/social-14-0-mail_activity_team :target: https://translation.odoo-community.org/projects/social-15-0/social-15-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/14.0 :target: https://runbot.odoo-community.org/runbot/205/15.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -58,13 +58,18 @@ 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:%2014.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:%2015.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.
@ -74,17 +79,18 @@ Credits
Authors Authors
~~~~~~~ ~~~~~~~
* Eficent * ForgeFlow
* Sodexis * Sodexis
Contributors Contributors
~~~~~~~~~~~~ ~~~~~~~~~~~~
* `Eficent <https://www.eficent.com>`_: * `ForgeFlow <https://www.forgeflow.com>`_:
* Jordi Ballester Alomar (jordi.ballester@eficent.com) * Jordi Ballester Alomar (jordi.ballester@eficent.com)
* Miquel Raïch (miquel.raich@eficent.com) * Miquel Raïch (miquel.raich@eficent.com)
* Pedro Gonzalez (pedro.gonzalez@pesol.es) * Bernat Puig Font (bernat.puig@forgeflow.com)
* Pedro Gonzalez (pedro.gonzalez@pesol.es)
* `Tecnativa <https://www.tecnativa.com>`_: * `Tecnativa <https://www.tecnativa.com>`_:
* David Vidal * David Vidal
@ -102,6 +108,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/14.0/mail_activity_team>`_ project on GitHub. This module is part of the `OCA/social <https://github.com/OCA/social/tree/15.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.

View File

@ -1,26 +1,30 @@
# Copyright 2018 Eficent Business and IT Consulting Services, S.L. # Copyright 2018-22 ForgeFlow Business and IT Consulting Services, S.L.
# Copyright 2021 Sodexis # Copyright 2021 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{ {
"name": "Mail Activity Team", "name": "Mail Activity Team",
"summary": "Add Teams to Activities", "summary": "Add Teams to Activities",
"version": "14.0.1.0.0", "version": "15.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",
"author": "Eficent, Sodexis, Odoo Community Association (OCA)", "author": "ForgeFlow, Sodexis, Odoo Community Association (OCA)",
"license": "AGPL-3", "license": "AGPL-3",
"installable": True, "installable": True,
"depends": ["mail_activity_board"], "depends": ["mail_activity_board"],
"data": [ "data": [
"views/assets_backend.xml",
"security/ir.model.access.csv", "security/ir.model.access.csv",
"security/mail_activity_team_security.xml", "security/mail_activity_team_security.xml",
"views/mail_activity_team_views.xml", "views/mail_activity_team_views.xml",
"views/mail_activity_views.xml", "views/mail_activity_views.xml",
"views/res_users_views.xml", "views/res_users_views.xml",
], ],
"qweb": [ "assets": {
"static/src/xml/systray.xml", "web.assets_backend": [
], "mail_activity_team/static/src/js/systray.esm.js",
],
"web.assets_qweb": [
"mail_activity_team/static/src/xml/systray.xml",
],
},
} }

View File

@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 14.0\n" "Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@ -56,26 +56,17 @@ msgid "Created on"
msgstr "" msgstr ""
#. module: mail_activity_team #. module: mail_activity_team
#: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity__display_name
#: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity_mixin__display_name
#: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity_team__display_name #: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity_team__display_name
#: model:ir.model.fields,field_description:mail_activity_team.field_res_users__display_name
msgid "Display Name" msgid "Display Name"
msgstr "" msgstr ""
#. module: mail_activity_team #. module: mail_activity_team
#: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity__id
#: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity_mixin__id
#: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity_team__id #: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity_team__id
#: model:ir.model.fields,field_description:mail_activity_team.field_res_users__id
msgid "ID" msgid "ID"
msgstr "" msgstr ""
#. module: mail_activity_team #. module: mail_activity_team
#: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity____last_update
#: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity_mixin____last_update
#: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity_team____last_update #: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity_team____last_update
#: model:ir.model.fields,field_description:mail_activity_team.field_res_users____last_update
msgid "Last Modified on" msgid "Last Modified on"
msgstr "" msgstr ""
@ -152,7 +143,8 @@ msgstr ""
#. module: mail_activity_team #. module: mail_activity_team
#: 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 "The assigned user %s is not member of the team %s." msgid ""
"The assigned user %(user_name)s is not member of the team %(team_name)s."
msgstr "" msgstr ""
#. module: mail_activity_team #. module: mail_activity_team
@ -166,16 +158,7 @@ msgid "Users"
msgstr "" msgstr ""
#. module: mail_activity_team #. module: mail_activity_team
#: model:ir.model.fields,field_description:mail_activity_team.field_account_bank_statement_line__activity_team_user_ids
#: model:ir.model.fields,field_description:mail_activity_team.field_account_journal__activity_team_user_ids
#: model:ir.model.fields,field_description:mail_activity_team.field_account_move__activity_team_user_ids
#: model:ir.model.fields,field_description:mail_activity_team.field_account_payment__activity_team_user_ids
#: 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_product_product__activity_team_user_ids
#: model:ir.model.fields,field_description:mail_activity_team.field_product_template__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
#: model:ir.model.fields,field_description:mail_activity_team.field_res_users__activity_team_user_ids #: model:ir.model.fields,field_description:mail_activity_team.field_res_users__activity_team_user_ids
msgid "test field" msgid "test field"

View File

@ -1,4 +1,4 @@
# Copyright 2018 Eficent Business and IT Consulting Services, S.L. # Copyright 2018-22 ForgeFlow Business and IT Consulting Services, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import SUPERUSER_ID, _, api, fields, models from odoo import SUPERUSER_ID, _, api, fields, models
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
@ -11,7 +11,7 @@ class MailActivity(models.Model):
if not user_id: if not user_id:
user_id = self.env.uid user_id = self.env.uid
res_model = self.env.context.get("default_res_model") res_model = self.env.context.get("default_res_model")
model = self.env["ir.model"].search([("model", "=", res_model)], limit=1) model = self.sudo().env["ir.model"].search([("model", "=", res_model)], limit=1)
domain = [("member_ids", "in", [user_id])] domain = [("member_ids", "in", [user_id])]
if res_model: if res_model:
domain.extend( domain.extend(
@ -74,6 +74,10 @@ class MailActivity(models.Model):
not in activity.team_id.with_context(active_test=False).member_ids not in activity.team_id.with_context(active_test=False).member_ids
): ):
raise ValidationError( raise ValidationError(
_("The assigned user %s is not member of the team %s.") _(
% (activity.user_id.name, activity.team_id.name) "The assigned user %(user_name)s is "
"not member of the team %(team_name)s.",
user_name=activity.user_id.name,
team_name=activity.team_id.name,
)
) )

View File

@ -18,6 +18,22 @@ class MailActivityMixin(models.AbstractModel):
for rec in self: for rec in self:
rec.activity_team_user_ids = rec.activity_ids.mapped("team_id.member_ids") rec.activity_team_user_ids = rec.activity_ids.mapped("team_id.member_ids")
def _search_my_activity_date_deadline(self, operator, operand):
if not self._context.get("team_activities", False):
return super(MailActivityMixin, self)._search_my_activity_date_deadline(
operator, operand
)
activity_ids = self.env["mail.activity"]._search(
[
"|",
("user_id", "=", self.env.user.id),
"&",
("date_deadline", operator, operand),
("res_model", "=", self._name),
]
)
return [("activity_ids", "in", activity_ids)]
@api.model @api.model
def _search_activity_team_user_ids(self, operator, operand): def _search_activity_team_user_ids(self, operator, operand):
return [("activity_ids.team_id.member_ids", operator, operand)] return [("activity_ids.team_id.member_ids", operator, operand)]

View File

@ -1,4 +1,4 @@
# Copyright 2018 Eficent Business and IT Consulting Services, S.L. # Copyright 2018-22 ForgeFlow Business and IT Consulting Services, S.L.
# Copyright 2021 Sodexis # Copyright 2021 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models from odoo import api, fields, models
@ -19,8 +19,8 @@ class MailActivityTeam(models.Model):
domain.append(("res_model_id", "in", team.res_model_ids.ids)) domain.append(("res_model_id", "in", team.res_model_ids.ids))
team.count_missing_activities = activity_model.search(domain, count=True) team.count_missing_activities = activity_model.search(domain, count=True)
name = fields.Char(string="Name", required=True, translate=True) name = fields.Char(required=True, translate=True)
active = fields.Boolean(string="Active", default=True) active = fields.Boolean(default=True)
res_model_ids = fields.Many2many( res_model_ids = fields.Many2many(
comodel_name="ir.model", comodel_name="ir.model",
string="Used models", string="Used models",

View File

@ -1,4 +1,4 @@
# Copyright 2018 Eficent Business and IT Consulting Services, S.L. # Copyright 2018-22 ForgeFlow Business and IT Consulting Services, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models, modules from odoo import api, fields, models, modules
@ -44,7 +44,7 @@ class ResUsers(models.Model):
activity_data = self.env.cr.dictfetchall() activity_data = self.env.cr.dictfetchall()
model_ids = [a["id"] for a in activity_data] model_ids = [a["id"] for a in activity_data]
model_names = { model_names = {
n[0]: n[1] for n in self.env["ir.model"].browse(model_ids).name_get() n[0]: n[1] for n in self.env["ir.model"].sudo().browse(model_ids).name_get()
} }
user_activities = {} user_activities = {}
for activity in activity_data: for activity in activity_data:
@ -66,9 +66,4 @@ class ResUsers(models.Model):
] += activity["count"] ] += activity["count"]
if activity["states"] in ("today", "overdue"): if activity["states"] in ("today", "overdue"):
user_activities[activity["model"]]["total_count"] += activity["count"] user_activities[activity["model"]]["total_count"] += activity["count"]
if activity["user_id"] == user and activity["states"] in (
"today",
"overdue",
):
user_activities[activity["model"]]["total_count"] -= activity["count"]
return list(user_activities.values()) return list(user_activities.values())

View File

@ -1,8 +1,9 @@
* `Eficent <https://www.eficent.com>`_: * `ForgeFlow <https://www.forgeflow.com>`_:
* Jordi Ballester Alomar (jordi.ballester@eficent.com) * Jordi Ballester Alomar (jordi.ballester@eficent.com)
* Miquel Raïch (miquel.raich@eficent.com) * Miquel Raïch (miquel.raich@eficent.com)
* Pedro Gonzalez (pedro.gonzalez@pesol.es) * Bernat Puig Font (bernat.puig@forgeflow.com)
* Pedro Gonzalez (pedro.gonzalez@pesol.es)
* `Tecnativa <https://www.tecnativa.com>`_: * `Tecnativa <https://www.tecnativa.com>`_:
* David Vidal * David Vidal

View File

@ -0,0 +1 @@
* In next version systray.esm.js file should be changed as added in comments.

View File

@ -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/14.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-14-0/social-14-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/14.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/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>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,11 +379,12 @@ 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="#bug-tracker" id="id2">Bug Tracker</a></li> <li><a class="reference internal" href="#known-issues-roadmap" id="id2">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul> <li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li> <li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li> <li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li> <li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -406,32 +407,39 @@ 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="#id2">Bug Tracker</a></h1> <h1><a class="toc-backref" href="#id3">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:%2014.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:%2015.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="#id3">Credits</a></h1> <h1><a class="toc-backref" href="#id4">Credits</a></h1>
<div class="section" id="authors"> <div class="section" id="authors">
<h2><a class="toc-backref" href="#id4">Authors</a></h2> <h2><a class="toc-backref" href="#id5">Authors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Eficent</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="#id5">Contributors</a></h2> <h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul class="simple"> <ul class="simple">
<li><a class="reference external" href="https://www.eficent.com">Eficent</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&#64;eficent.com">jordi.ballester&#64;eficent.com</a>)</li> <li>Jordi Ballester Alomar (<a class="reference external" href="mailto:jordi.ballester&#64;eficent.com">jordi.ballester&#64;eficent.com</a>)</li>
<li>Miquel Raïch (<a class="reference external" href="mailto:miquel.raich&#64;eficent.com">miquel.raich&#64;eficent.com</a>)</li> <li>Miquel Raïch (<a class="reference external" href="mailto:miquel.raich&#64;eficent.com">miquel.raich&#64;eficent.com</a>)</li>
<li>Pedro Gonzalez (<a class="reference external" href="mailto:pedro.gonzalez&#64;pesol.es">pedro.gonzalez&#64;pesol.es</a>)</li> <li>Bernat Puig Font (<a class="reference external" href="mailto:bernat.puig&#64;forgeflow.com">bernat.puig&#64;forgeflow.com</a>)</li>
</ul> </ul>
</li> </li>
<li>Pedro Gonzalez (<a class="reference external" href="mailto:pedro.gonzalez&#64;pesol.es">pedro.gonzalez&#64;pesol.es</a>)</li>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul> <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>David Vidal</li> <li>David Vidal</li>
</ul> </ul>
@ -439,13 +447,13 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2> <h2><a class="toc-backref" href="#id7">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/14.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/15.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>

View File

@ -0,0 +1,94 @@
/** @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.user_context = session.user_context;
this.user_context = _.extend({}, session.user_context, {
team_activities: false,
});
},
_updateCounter: function () {
this._super.apply(this, arguments);
this.$(".o_notification_counter").text(this.activityCounter);
},
_onClickFilterButton: function (event) {
var self = this;
event.stopPropagation();
self.$filter_buttons.removeClass("active");
var $target = $(event.currentTarget);
$target.addClass("active");
self.filter = $target.data("filter");
self.user_context = _.extend({}, session.user_context, {
team_activities: self.filter === "team",
});
self._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,
});
}
},
_getActivityData: function () {
var self = this;
return self
._rpc({
model: "res.users",
method: "systray_get_activities",
args: [],
kwargs: {context: self.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);
});
},
});

View File

@ -1,102 +0,0 @@
odoo.define("mail_activity_team.systray.ActivityMenu", function (require) {
"use strict";
var ActivityMenu = require("mail.systray.ActivityMenu");
var session = require("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";
session.user_context = _.extend({}, session.user_context, {
team_activities: false,
});
},
_updateCounter: function () {
this._super.apply(this, arguments);
this.$(".o_notification_counter").text(this.activityCounter);
},
_onClickFilterButton: function (event) {
var self = this;
event.stopPropagation();
self.$filter_buttons.removeClass("active");
var $target = $(event.currentTarget);
$target.addClass("active");
self.filter = $target.data("filter");
session.user_context = _.extend({}, session.user_context, {
team_activities: self.filter === "team",
});
self._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 = {};
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,
});
}
},
_getActivityData: function () {
var self = this;
return self._super.apply(self, arguments).then(function () {
session.user_context = _.extend({}, session.user_context, {
team_activities: !session.user_context.team_activities,
});
self._rpc({
model: "res.users",
method: "systray_get_activities",
args: [],
kwargs: {
context: session.user_context,
},
}).then(function (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);
session.user_context = _.extend({}, session.user_context, {
team_activities: !session.user_context.team_activities,
});
});
});
},
});
});

View File

@ -1,4 +1,4 @@
# Copyright 2018 Eficent Business and IT Consulting Services, S.L. # Copyright 2018-22 ForgeFlow Business and IT Consulting Services, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase from odoo.tests.common import TransactionCase
@ -48,7 +48,7 @@ class TestMailActivityTeam(TransactionCase):
"delay_count": 5, "delay_count": 5,
"delay_unit": "days", "delay_unit": "days",
"summary": "ACT 1 : Presentation, barbecue, ... ", "summary": "ACT 1 : Presentation, barbecue, ... ",
"res_model_id": self.partner_ir_model.id, "res_model": self.partner_ir_model.model,
} }
) )
self.activity2 = activity_type_model.create( self.activity2 = activity_type_model.create(
@ -57,7 +57,7 @@ class TestMailActivityTeam(TransactionCase):
"delay_count": 6, "delay_count": 6,
"delay_unit": "days", "delay_unit": "days",
"summary": "ACT 2 : I want to show you my ERP !", "summary": "ACT 2 : I want to show you my ERP !",
"res_model_id": self.partner_ir_model.id, "res_model": self.partner_ir_model.model,
} }
) )
@ -148,7 +148,6 @@ 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."
) )
self.act2.team_id = False
self.act2._onchange_team_id() self.act2._onchange_team_id()
self.assertEqual(self.act2.user_id, self.employee) self.assertEqual(self.act2.user_id, self.employee)
self.act2.team_id = self.team2 self.act2.team_id = self.team2
@ -174,7 +173,7 @@ class TestMailActivityTeam(TransactionCase):
def test_schedule_activity(self): def test_schedule_activity(self):
"""Correctly assign teams to auto scheduled activities. Those won't """Correctly assign teams to auto scheduled activities. Those won't
trigger onchanges and could raise constraints and team missmatches""" trigger onchanges and could raise constraints and team missmatches"""
partner_record = self.employee.partner_id.sudo(self.employee.id) partner_record = self.employee.partner_id.with_user(self.employee.id)
activity = partner_record.activity_schedule( activity = partner_record.activity_schedule(
user_id=self.employee2.id, user_id=self.employee2.id,
activity_type_id=self.env.ref("mail.mail_activity_data_call").id, activity_type_id=self.env.ref("mail.mail_activity_data_call").id,

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="assets_backend" name="mail assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script
type="text/javascript"
src="/mail_activity_team/static/src/js/systray.js"
/>
</xpath>
</template>
</odoo>