mirror of https://github.com/OCA/social.git
[MIG] mail_activity_team: Migration to 15.0
parent
e4ab8408f7
commit
7e6c9176e0
|
@ -14,13 +14,13 @@ Mail Activity Team
|
|||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
.. |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
|
||||
.. |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
|
||||
.. |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
|
||||
|
||||
|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
|
||||
teams.
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
* In next version systray.esm.js file should be changed as added in comments.
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
|
@ -74,17 +79,18 @@ Credits
|
|||
Authors
|
||||
~~~~~~~
|
||||
|
||||
* Eficent
|
||||
* ForgeFlow
|
||||
* Sodexis
|
||||
|
||||
Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* `Eficent <https://www.eficent.com>`_:
|
||||
* `ForgeFlow <https://www.forgeflow.com>`_:
|
||||
|
||||
* Jordi Ballester Alomar (jordi.ballester@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>`_:
|
||||
|
||||
* 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
|
||||
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.
|
||||
|
|
|
@ -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
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
{
|
||||
"name": "Mail Activity Team",
|
||||
"summary": "Add Teams to Activities",
|
||||
"version": "14.0.1.0.0",
|
||||
"version": "15.0.1.0.0",
|
||||
"development_status": "Alpha",
|
||||
"category": "Social Network",
|
||||
"website": "https://github.com/OCA/social",
|
||||
"author": "Eficent, Sodexis, Odoo Community Association (OCA)",
|
||||
"author": "ForgeFlow, Sodexis, Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"installable": True,
|
||||
"depends": ["mail_activity_board"],
|
||||
"data": [
|
||||
"views/assets_backend.xml",
|
||||
"security/ir.model.access.csv",
|
||||
"security/mail_activity_team_security.xml",
|
||||
"views/mail_activity_team_views.xml",
|
||||
"views/mail_activity_views.xml",
|
||||
"views/res_users_views.xml",
|
||||
],
|
||||
"qweb": [
|
||||
"static/src/xml/systray.xml",
|
||||
],
|
||||
"assets": {
|
||||
"web.assets_backend": [
|
||||
"mail_activity_team/static/src/js/systray.esm.js",
|
||||
],
|
||||
"web.assets_qweb": [
|
||||
"mail_activity_team/static/src/xml/systray.xml",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Project-Id-Version: Odoo Server 15.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
|
@ -56,26 +56,17 @@ msgid "Created on"
|
|||
msgstr ""
|
||||
|
||||
#. 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_res_users__display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. 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_res_users__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. 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_res_users____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr ""
|
||||
|
||||
|
@ -152,7 +143,8 @@ msgstr ""
|
|||
#. module: mail_activity_team
|
||||
#: code:addons/mail_activity_team/models/mail_activity.py:0
|
||||
#, 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 ""
|
||||
|
||||
#. module: mail_activity_team
|
||||
|
@ -166,16 +158,7 @@ msgid "Users"
|
|||
msgstr ""
|
||||
|
||||
#. 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_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_users__activity_team_user_ids
|
||||
msgid "test field"
|
||||
|
|
|
@ -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).
|
||||
from odoo import SUPERUSER_ID, _, api, fields, models
|
||||
from odoo.exceptions import ValidationError
|
||||
|
@ -11,7 +11,7 @@ class MailActivity(models.Model):
|
|||
if not user_id:
|
||||
user_id = self.env.uid
|
||||
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])]
|
||||
if res_model:
|
||||
domain.extend(
|
||||
|
@ -74,6 +74,10 @@ class MailActivity(models.Model):
|
|||
not in activity.team_id.with_context(active_test=False).member_ids
|
||||
):
|
||||
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,
|
||||
)
|
||||
)
|
||||
|
|
|
@ -18,6 +18,22 @@ class MailActivityMixin(models.AbstractModel):
|
|||
for rec in self:
|
||||
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
|
||||
def _search_activity_team_user_ids(self, operator, operand):
|
||||
return [("activity_ids.team_id.member_ids", operator, operand)]
|
||||
|
|
|
@ -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
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
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))
|
||||
team.count_missing_activities = activity_model.search(domain, count=True)
|
||||
|
||||
name = fields.Char(string="Name", required=True, translate=True)
|
||||
active = fields.Boolean(string="Active", default=True)
|
||||
name = fields.Char(required=True, translate=True)
|
||||
active = fields.Boolean(default=True)
|
||||
res_model_ids = fields.Many2many(
|
||||
comodel_name="ir.model",
|
||||
string="Used models",
|
||||
|
|
|
@ -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).
|
||||
from odoo import api, fields, models, modules
|
||||
|
||||
|
@ -44,7 +44,7 @@ class ResUsers(models.Model):
|
|||
activity_data = self.env.cr.dictfetchall()
|
||||
model_ids = [a["id"] for a in activity_data]
|
||||
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 = {}
|
||||
for activity in activity_data:
|
||||
|
@ -66,9 +66,4 @@ class ResUsers(models.Model):
|
|||
] += activity["count"]
|
||||
if activity["states"] in ("today", "overdue"):
|
||||
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())
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
* `Eficent <https://www.eficent.com>`_:
|
||||
* `ForgeFlow <https://www.forgeflow.com>`_:
|
||||
|
||||
* Jordi Ballester Alomar (jordi.ballester@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>`_:
|
||||
|
||||
* David Vidal
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
* 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 !!
|
||||
!! 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>
|
||||
<div class="admonition important">
|
||||
<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">
|
||||
<ul class="simple">
|
||||
<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="#credits" id="id3">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</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="id3">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="id5">Authors</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>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -406,32 +407,39 @@ assigned team.</p>
|
|||
<em>Dashboards / Activities</em>, and then filter by a specific team or group by
|
||||
teams.</p>
|
||||
</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">
|
||||
<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>.
|
||||
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
|
||||
<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>
|
||||
</div>
|
||||
<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">
|
||||
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
|
||||
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Eficent</li>
|
||||
<li>ForgeFlow</li>
|
||||
<li>Sodexis</li>
|
||||
</ul>
|
||||
</div>
|
||||
<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">
|
||||
<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@eficent.com">jordi.ballester@eficent.com</a>)</li>
|
||||
<li>Miquel Raïch (<a class="reference external" href="mailto:miquel.raich@eficent.com">miquel.raich@eficent.com</a>)</li>
|
||||
<li>Pedro Gonzalez (<a class="reference external" href="mailto:pedro.gonzalez@pesol.es">pedro.gonzalez@pesol.es</a>)</li>
|
||||
<li>Bernat Puig Font (<a class="reference external" href="mailto:bernat.puig@forgeflow.com">bernat.puig@forgeflow.com</a>)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Pedro Gonzalez (<a class="reference external" href="mailto:pedro.gonzalez@pesol.es">pedro.gonzalez@pesol.es</a>)</li>
|
||||
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
|
||||
<li>David Vidal</li>
|
||||
</ul>
|
||||
|
@ -439,13 +447,13 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
|||
</ul>
|
||||
</div>
|
||||
<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>
|
||||
<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
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
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>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
},
|
||||
});
|
|
@ -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,
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
|
@ -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).
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
@ -48,7 +48,7 @@ class TestMailActivityTeam(TransactionCase):
|
|||
"delay_count": 5,
|
||||
"delay_unit": "days",
|
||||
"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(
|
||||
|
@ -57,7 +57,7 @@ class TestMailActivityTeam(TransactionCase):
|
|||
"delay_count": 6,
|
||||
"delay_unit": "days",
|
||||
"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.act2.team_id, self.team1, "Error: Activity 2 should have Team 1."
|
||||
)
|
||||
self.act2.team_id = False
|
||||
self.act2._onchange_team_id()
|
||||
self.assertEqual(self.act2.user_id, self.employee)
|
||||
self.act2.team_id = self.team2
|
||||
|
@ -174,7 +173,7 @@ class TestMailActivityTeam(TransactionCase):
|
|||
def test_schedule_activity(self):
|
||||
"""Correctly assign teams to auto scheduled activities. Those won't
|
||||
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(
|
||||
user_id=self.employee2.id,
|
||||
activity_type_id=self.env.ref("mail.mail_activity_data_call").id,
|
||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue