Skip to content

Commit

Permalink
[17.0][IMP] mail_activity_team: add team fields on mail.activity.sche…
Browse files Browse the repository at this point in the history
…dule
  • Loading branch information
ilo committed Oct 9, 2024
1 parent 54d7daa commit 480e3d6
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 17 deletions.
4 changes: 4 additions & 0 deletions mail_activity_team/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ Contributors

- Son Ho sonhd@trobz.com

- [Camptocamp] (https://camptocamp.com):

- Italo LOPES italo.lopes@camptocamp.com

Other credits
-------------

Expand Down
1 change: 1 addition & 0 deletions mail_activity_team/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import models
from . import wizard
1 change: 1 addition & 0 deletions mail_activity_team/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"views/mail_activity_team_views.xml",
"views/mail_activity_views.xml",
"views/res_users_views.xml",
"wizard/mail_activity_schedule.xml",
],
"assets": {
"web.assets_backend": [
Expand Down
2 changes: 2 additions & 0 deletions mail_activity_team/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
- Raf Ven
- [Trobz] (https://trobz.com):
- Son Ho <sonhd@trobz.com>
- [Camptocamp] (https://camptocamp.com):
- Italo LOPES <italo.lopes@camptocamp.com>
38 changes: 21 additions & 17 deletions mail_activity_team/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Mail Activity Team</title>
<style type="text/css">

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.

See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/

Expand Down Expand Up @@ -379,19 +379,19 @@ <h1 class="title">Mail Activity Team</h1>
<p><strong>Table of contents</strong></p>
<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="#other-credits" id="id6">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-1">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="#credits" id="toc-entry-3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
<li><a class="reference internal" href="#other-credits" id="toc-entry-6">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>To set up new teams:</p>
<ol class="arabic simple">
<li>Go to <em>Settings / Activate developer mode</em></li>
Expand All @@ -408,24 +408,24 @@ <h1><a class="toc-backref" href="#id1">Usage</a></h1>
/ Activities</em>, and then filter by a specific team or group by teams.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#toc-entry-2">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 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:%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>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<ul class="simple">
<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="#toc-entry-5">Contributors</a></h2>
<ul class="simple">
<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>
Expand All @@ -446,15 +446,19 @@ <h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<li>Son Ho <a class="reference external" href="mailto:sonhd&#64;trobz.com">sonhd&#64;trobz.com</a></li>
</ul>
</li>
<li>[Camptocamp] (<a class="reference external" href="https://camptocamp.com">https://camptocamp.com</a>):<ul>
<li>Italo LOPES <a class="reference external" href="mailto:italo.lopes&#64;camptocamp.com">italo.lopes&#64;camptocamp.com</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#id6">Other credits</a></h2>
<h2><a class="toc-backref" href="#toc-entry-6">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">
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
<h2><a class="toc-backref" href="#toc-entry-7">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
Expand Down
1 change: 1 addition & 0 deletions mail_activity_team/wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import mail_activity_schedule
28 changes: 28 additions & 0 deletions mail_activity_team/wizard/mail_activity_schedule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2024 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class MailActivitySchedule(models.TransientModel):
_inherit = "mail.activity.schedule"

def _get_default_team_id(self, user_id=None):
if not user_id:
user_id = self.env.uid
res_model = self.env.context.get("default_res_model")
model = self.sudo().env["ir.model"].search([("model", "=", res_model)], limit=1)
domain = [("member_ids", "in", [user_id])]
if res_model:
domain.extend(
["|", ("res_model_ids", "=", False), ("res_model_ids", "in", model.ids)]
)
return self.env["mail.activity.team"].search(domain, limit=1)

team_user_id = fields.Many2one(
string="Team user", related="activity_user_id", readonly=False
)

team_id = fields.Many2one(
comodel_name="mail.activity.team", default=lambda s: s._get_default_team_id()
)
28 changes: 28 additions & 0 deletions mail_activity_team/wizard/mail_activity_schedule.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" ?>
<odoo>

<record id="mail_activity_schedule_view_form" model="ir.ui.view">
<field name="name">mail.activity.view.form.popup</field>
<field name="model">mail.activity.schedule</field>
<field name="inherit_id" ref="mail.mail_activity_schedule_view_form" />
<field name="arch" type="xml">
<field name="activity_user_id" position="attributes">
<attribute name="invisible">team_id</attribute>
</field>
<field name="activity_user_id" position="after">
<field name="res_model_id" invisible="1" />
<field
name="team_user_id"
invisible="not team_id"
domain="[('activity_team_ids', '=', team_id)]"
/>
<field
name="team_id"
options="{'no_create': True, 'no_open': True}"
domain="['|', ('res_model_ids', '=', False), ('res_model_ids', '=', res_model_id)]"
/>
</field>
</field>
</record>

</odoo>

0 comments on commit 480e3d6

Please sign in to comment.