[MIG] mail_activity_team: Migration to 17.0

pull/1321/head
sonhd91 2024-03-05 14:27:15 +07:00
parent 92367b6503
commit e3c9b9d85e
17 changed files with 134 additions and 220 deletions

View File

@ -7,7 +7,7 @@ Mail Activity Team
!! 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. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:03f9f5230325096db55adb5d53806d70d4a396af32f4de252271faba5d5d0b88 !! source digest: sha256:1ec2986e180d35e605a67ecb2b8256da4ee87b09abedeab928d81618833db93c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png .. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
@ -17,13 +17,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/16.0/mail_activity_team :target: https://github.com/OCA/social/tree/17.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-16-0/social-16-0-mail_activity_team :target: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_activity_team
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=16.0 :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=17.0
:alt: Try me on Runboat :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -45,21 +45,20 @@ Usage
To set up new teams: To set up new teams:
#. Go to *Settings / Activate developer mode* 1. Go to *Settings / Activate developer mode*
#. Go to *Settings / Technical / Email / Activity Teams* 2. Go to *Settings / Technical / Discuss / Activity Teams*
#. Create a new Team and assign (optionally) the models in which it will 3. Create a new Team and assign (optionally) the models in which it will
be used, and the members of the team. be used, and the members of the team.
You can also assign a user to Activity teams going to You can also assign a user to Activity teams going to *Settings / Users
*Settings / Users & Companies / Users*, and in the *Preferences* tab, field & Companies / Users*, and in the *Preferences* tab, field Activity
Activity Teams. Teams.
When you create a new activity the application will propose the user's When you create a new activity the application will propose the user's
assigned team. assigned team.
You can report on the activities assigned to a team going to You can report on the activities assigned to a team going to *Dashboards
*Dashboards / Activities*, and then filter by a specific team or group by / Activities*, and then filter by a specific team or group by teams.
teams.
Bug Tracker Bug Tracker
=========== ===========
@ -67,7 +66,7 @@ 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 to smash it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
`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**>`_. `feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_activity_team%0Aversion:%2017.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.
@ -75,29 +74,41 @@ Credits
======= =======
Authors Authors
~~~~~~~ -------
* ForgeFlow * ForgeFlow
* Sodexis * Sodexis
Contributors Contributors
~~~~~~~~~~~~ ------------
* `ForgeFlow <https://www.forgeflow.com>`_: - `ForgeFlow <https://www.forgeflow.com>`__:
* Jordi Ballester Alomar (jordi.ballester@forgeflow.com) - Jordi Ballester Alomar (jordi.ballester@forgeflow.com)
* Miquel Raïch (miquel.raich@forgeflow.com) - Miquel Raïch (miquel.raich@forgeflow.com)
* Bernat Puig Font (bernat.puig@forgeflow.com) - Bernat Puig Font (bernat.puig@forgeflow.com)
* Pedro Gonzalez (pedro.gonzalez@pesol.es)
* `Tecnativa <https://www.tecnativa.com>`_:
* David Vidal - Pedro Gonzalez (pedro.gonzalez@pesol.es)
* `Dynapps <https://www.dynapps.eu>`_: - `Tecnativa <https://www.tecnativa.com>`__:
* Raf Ven - David Vidal
- `Dynapps <https://www.dynapps.eu>`__:
- Raf Ven
- [Trobz] (https://trobz.com):
- Son Ho sonhd@trobz.com
Other credits
-------------
The migration of this module from 16.0 to 17.0 was financially supported
by Camptocamp
Maintainers Maintainers
~~~~~~~~~~~ -----------
This module is maintained by the OCA. This module is maintained by the OCA.
@ -109,6 +120,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/16.0/mail_activity_team>`_ project on GitHub. This module is part of the `OCA/social <https://github.com/OCA/social/tree/17.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

@ -4,7 +4,7 @@
{ {
"name": "Mail Activity Team", "name": "Mail Activity Team",
"summary": "Add Teams to Activities", "summary": "Add Teams to Activities",
"version": "16.0.1.0.0", "version": "17.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",

View File

@ -17,7 +17,7 @@ class MailActivityTeam(models.Model):
domain.append(("user_id", "in", team.member_ids.ids)) domain.append(("user_id", "in", team.member_ids.ids))
if team.res_model_ids: if team.res_model_ids:
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_count(domain)
name = fields.Char(required=True, translate=True) name = fields.Char(required=True, translate=True)
active = fields.Boolean(default=True) active = fields.Boolean(default=True)

View File

@ -44,7 +44,11 @@ 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"].sudo().browse(model_ids).name_get() n["id"]: n["display_name"]
for n in self.env["ir.model"]
.sudo()
.browse(model_ids)
.read(["id", "display_name"])
} }
user_activities = {} user_activities = {}
for activity in activity_data: for activity in activity_data:

View File

@ -7,3 +7,5 @@
- David Vidal - David Vidal
- [Dynapps](https://www.dynapps.eu): - [Dynapps](https://www.dynapps.eu):
- Raf Ven - Raf Ven
- [Trobz] (https://trobz.com):
- Son Ho <sonhd@trobz.com>

View File

@ -0,0 +1 @@
The migration of this module from 16.0 to 17.0 was financially supported by Camptocamp

View File

@ -1,7 +1,7 @@
To set up new teams: To set up new teams:
1. Go to *Settings / Activate developer mode* 1. Go to *Settings / Activate developer mode*
2. Go to *Settings / Technical / Email / Activity Teams* 2. Go to *Settings / Technical / Discuss / Activity Teams*
3. Create a new Team and assign (optionally) the models in which it 3. Create a new Team and assign (optionally) the models in which it
will be used, and the members of the team. will be used, and the members of the team.

View File

@ -1,17 +0,0 @@
To set up new teams:
#. Go to *Settings / Activate developer mode*
#. Go to *Settings / Technical / Email / Activity Teams*
#. Create a new Team and assign (optionally) the models in which it will
be used, and the members of the team.
You can also assign a user to Activity teams going to
*Settings / Users & Companies / Users*, and in the *Preferences* tab, field
Activity Teams.
When you create a new activity the application will propose the user's
assigned team.
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.

View File

@ -1,4 +1,3 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
access_mail_activity_team_all,mail.activity.team.all,model_mail_activity_team,,1,0,0,0
access_mail_activity_team_user,mail.activity.team.user,model_mail_activity_team,base.group_user,1,1,0,0 access_mail_activity_team_user,mail.activity.team.user,model_mail_activity_team,base.group_user,1,1,0,0
access_mail_activity_team_system_user,mail.activity.team.system.user,model_mail_activity_team,base.group_system,1,1,1,1 access_mail_activity_team_system_user,mail.activity.team.system.user,model_mail_activity_team,base.group_system,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
access_mail_activity_team_all mail.activity.team.all model_mail_activity_team 1 0 0 0
2 access_mail_activity_team_user mail.activity.team.user model_mail_activity_team base.group_user 1 1 0 0
3 access_mail_activity_team_system_user mail.activity.team.system.user model_mail_activity_team base.group_system 1 1 1 1

View File

@ -1,20 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" /> <meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Mail Activity Team</title> <title>Mail Activity Team</title>
<style type="text/css"> <style type="text/css">
/* /*
:Author: David Goodger (goodger@python.org) :Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ :Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain. :Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils. Default cascading style sheet for the HTML output of Docutils.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet. customize this style sheet.
*/ */
@ -367,9 +366,9 @@ 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. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:03f9f5230325096db55adb5d53806d70d4a396af32f4de252271faba5d5d0b88 !! source digest: sha256:1ec2986e180d35e605a67ecb2b8256da4ee87b09abedeab928d81618833db93c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" 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 image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/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 image-reference" 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 image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p> <p><a class="reference external image-reference" 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 image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/17.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 image-reference" href="https://translation.odoo-community.org/projects/social-17-0/social-17-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 image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-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>
@ -380,53 +379,53 @@ Only for development or testing purpose, do not use in production.
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<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="toc-entry-1">Usage</a></li> <li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li> <li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul> <li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li> <li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li> <li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li> <li><a class="reference internal" href="#other-credits" id="id6">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</div> </div>
<div class="section" id="usage"> <div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1> <h1><a class="toc-backref" href="#id1">Usage</a></h1>
<p>To set up new teams:</p> <p>To set up new teams:</p>
<ol class="arabic simple"> <ol class="arabic simple">
<li>Go to <em>Settings / Activate developer mode</em></li> <li>Go to <em>Settings / Activate developer mode</em></li>
<li>Go to <em>Settings / Technical / Email / Activity Teams</em></li> <li>Go to <em>Settings / Technical / Discuss / Activity Teams</em></li>
<li>Create a new Team and assign (optionally) the models in which it will <li>Create a new Team and assign (optionally) the models in which it will
be used, and the members of the team.</li> be used, and the members of the team.</li>
</ol> </ol>
<p>You can also assign a user to Activity teams going to <p>You can also assign a user to Activity teams going to <em>Settings / Users
<em>Settings / Users &amp; Companies / Users</em>, and in the <em>Preferences</em> tab, field &amp; Companies / Users</em>, and in the <em>Preferences</em> tab, field Activity
Activity Teams.</p> Teams.</p>
<p>When you create a new activity the application will propose the users <p>When you create a new activity the application will propose the users
assigned team.</p> assigned team.</p>
<p>You can report on the activities assigned to a team going to <p>You can report on the activities assigned to a team going to <em>Dashboards
<em>Dashboards / Activities</em>, and then filter by a specific team or group by / Activities</em>, and then filter by a specific team or group by teams.</p>
teams.</p>
</div> </div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">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 to smash it by providing a detailed and welcomed If you spotted it first, help us to smash 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:%2016.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:%2017.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="#toc-entry-3">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="#toc-entry-4">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="#toc-entry-5">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&#64;forgeflow.com">jordi.ballester&#64;forgeflow.com</a>)</li> <li>Jordi Ballester Alomar (<a class="reference external" href="mailto:jordi.ballester&#64;forgeflow.com">jordi.ballester&#64;forgeflow.com</a>)</li>
@ -443,16 +442,25 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<li>Raf Ven</li> <li>Raf Ven</li>
</ul> </ul>
</li> </li>
<li>[Trobz] (<a class="reference external" href="https://trobz.com">https://trobz.com</a>):<ul>
<li>Son Ho <a class="reference external" href="mailto:sonhd&#64;trobz.com">sonhd&#64;trobz.com</a></li>
</ul>
</li>
</ul> </ul>
</div> </div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#id6">Other credits</a></h2>
<p>The migration of this module from 16.0 to 17.0 was financially supported
by Camptocamp</p>
</div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">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/16.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/17.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

@ -2,30 +2,26 @@
<templates> <templates>
<t <t
t-name="ActivityMenuView" t-name="ActivityMenuView"
t-inherit="mail.ActivityMenuView" t-inherit="mail.ActivityMenu"
t-inherit-mode="extension" t-inherit-mode="extension"
owl="1"
>
<xpath
expr="//div[hasclass('o_ActivityMenuView_activityGroups')]"
position="before"
> >
<xpath expr="//div[1]" position="before">
<div class="o_mail_systray_dropdown_top"> <div class="o_mail_systray_dropdown_top">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li class="nav-item"> <li class="nav-item cursor-pointer">
<a <a
class="my_activities o_filter_nav_item nav-link active" class="my_activities o_filter_nav_item nav-link active"
data-filter='my' data-filter='my'
t-on-click="activityMenuView.onClickActivityFilter" t-on-click="() => this.onClickActivityFilter('my_activities')"
> >
My Activities My Activities
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item cursor-pointer">
<a <a
class="team_activities o_filter_nav_item nav-link" class="team_activities o_filter_nav_item nav-link"
data-filter='team' data-filter='team'
t-on-click="activityMenuView.onClickActivityFilter" t-on-click="() => this.onClickActivityFilter('team_activities')"
> >
Team Activities Team Activities
</a> </a>

View File

@ -1,55 +0,0 @@
/** @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,
}
);
}
},
},
});

View File

@ -0,0 +1,37 @@
/** @odoo-module */
import {ActivityMenu} from "@mail/core/web/activity_menu";
import {patch} from "@web/core/utils/patch";
patch(ActivityMenu.prototype, {
setup() {
super.setup();
this.currentFilter = "my";
},
activateFilter(filter_el) {
this.deactivateButtons();
filter_el.addClass("active");
this.currentFilter = filter_el.data("filter");
this.updateTeamActivitiesContext();
this.fetchSystrayActivities();
},
updateTeamActivitiesContext() {
var active = false;
if (this.currentFilter === "team") {
active = true;
}
this.env.services.orm.user.updateContext({team_activities: active});
},
onBeforeOpen() {
this.env.services.orm.user.updateContext({team_activities: false});
super.onBeforeOpen();
},
deactivateButtons() {
$(".o_filter_nav_item").removeClass("active");
},
onClickActivityFilter(filter) {
this.activateFilter($("." + filter));
},
});

View File

@ -1,68 +0,0 @@
/** @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,
});
},
},
});

View File

@ -13,7 +13,7 @@
<field name="activity_user_id" position="after"> <field name="activity_user_id" position="after">
<field <field
name="activity_team_id" name="activity_team_id"
attrs="{'invisible': [('activity_user_type', '!=', 'specific')]}" invisible="activity_user_type != 'specific'"
/> />
</field> </field>
</field> </field>

View File

@ -18,7 +18,7 @@
type="object" type="object"
class="oe_highlight" class="oe_highlight"
groups="base.group_no_one" groups="base.group_no_one"
attrs="{'invisible': [('count_missing_activities', '=', 0)]}" invisible="count_missing_activities == 0"
/> />
</header> </header>
<sheet string="Activity Team"> <sheet string="Activity Team">
@ -26,7 +26,7 @@
name="web_ribbon" name="web_ribbon"
title="Archived" title="Archived"
bg_color="bg-danger" bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}" invisible="active"
/> />
<group> <group>
<group name="base"> <group name="base">

View File

@ -7,14 +7,12 @@
<field name="inherit_id" ref="mail.mail_activity_view_form_popup" /> <field name="inherit_id" ref="mail.mail_activity_view_form_popup" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="user_id" position="attributes"> <field name="user_id" position="attributes">
<attribute <attribute name="invisible">team_id</attribute>
name="attrs"
>{'invisible': [('team_id', '!=', False)]}</attribute>
</field> </field>
<field name="user_id" position="after"> <field name="user_id" position="after">
<field <field
name="team_user_id" name="team_user_id"
attrs="{'invisible': [('team_id', '=', False)]}" invisible="not team_id"
domain="[('activity_team_ids', '=', team_id)]" domain="[('activity_team_ids', '=', team_id)]"
/> />
<field <field
@ -46,14 +44,12 @@
/> />
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="user_id" position="attributes"> <field name="user_id" position="attributes">
<attribute <attribute name="invisible">not team_id</attribute>
name="attrs"
>{'invisible': [('team_id', '=', False)]}</attribute>
</field> </field>
<field name="user_id" position="after"> <field name="user_id" position="after">
<field <field
name="team_user_id" name="team_user_id"
attrs="{'invisible': [('team_id', '!=', False)]}" invisible="team_id"
domain="[('activity_team_ids', '=', team_id)]" domain="[('activity_team_ids', '=', team_id)]"
/> />
<field <field