Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mail_activity_team/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Mail Activity Team",
"summary": "Add Teams to Activities",
"version": "19.0.1.0.0",
"version": "19.0.1.0.1",
"development_status": "Beta",
"category": "Social Network",
"website": "https://github.com/OCA/mail",
Expand Down
5 changes: 5 additions & 0 deletions mail_activity_team/models/mail_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from odoo import SUPERUSER_ID, api, fields, models
from odoo.exceptions import ValidationError

from odoo.addons.mail.tools.discuss import Store


class MailActivity(models.Model):
_inherit = "mail.activity"
Expand Down Expand Up @@ -130,3 +132,6 @@ def _onchange_activity_type_id(self):
if self.user_id not in members and members:
self.user_id = members[:1]
return res

def _to_store_defaults(self, target):
return super()._to_store_defaults(target) + [Store.One("team_id", ["name"])]
2 changes: 2 additions & 0 deletions mail_activity_team/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
- [CorporateHub](https://corporatehub.eu/)
- Alexey Pelykh <alexey.pelykh@corphub.eu>
- Stefan Rijnhart (<stefan@opener.amsterdam>)
- [Digiteasy](https://www.digiteasy.at/)
- Alvaro Estebanez
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {Activity} from "@mail/core/common/activity_model";
import {fields} from "@mail/core/common/record";

import {patch} from "@web/core/utils/patch";

patch(Activity.prototype, {
setup() {
super.setup(...arguments);
this.team_id = fields.One("mail.activity.team");
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {Record} from "@mail/core/common/record";

export class MailActivityTeam extends Record {
static _name = "mail.activity.team";
/** @type {String} */
name;
}

MailActivityTeam.register();
30 changes: 3 additions & 27 deletions mail_activity_team/static/src/core/web/activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,6 @@
t-inherit="mail.Activity"
t-inherit-mode="extension"
>
<!-- Prevent error rendering the avatar in case of missing user -->
<xpath
expr="//div/div[hasclass('o-mail-Activity-sidebar')]/a/img"
position="attributes"
>
<attribute name="t-if">props.activity.user_id</attribute>
</xpath>
<!-- Prevent error rendering the assigned user in case of missing user -->
<xpath
expr="//div/div/div[hasclass('o-mail-Activity-info')]/span[hasclass('o-mail-Activity-user')]"
position="attributes"
>
<attribute name="t-if">props.activity.user_id</attribute>
</xpath>
<!-- Show team in the condensed view -->
<xpath
expr="//div/div/div[hasclass('o-mail-Activity-info')]/span[hasclass('o-mail-Activity-user')]"
Expand All @@ -28,25 +14,15 @@
<span
class="o-mail-Activity-user px-1"
t-if="props.activity.team_id"
>(Team <t t-esc="props.activity.team_id[1]" />)
>(Team <t t-esc="props.activity.team_id.name" />)
</span>
</xpath>
<!-- Prevent error rendering the assigned user in case of missing user in the expanded view -->
<xpath
expr="//t[@t-esc='props.activity.persona.name']/parent::td/parent::tr"
position="attributes"
>
<attribute name="t-if">props.activity.user_id</attribute>
</xpath>
<!-- Show team in the expanded view -->
<xpath
expr="//t[@t-esc='props.activity.persona.name']/parent::td/parent::tr"
position="after"
>
<xpath expr="//tr[@t-if='props.activity.user_id']" position="after">
<tr t-if="props.activity.team_id">
<td class="text-end fw-bolder">Team</td>
<td>
<t t-esc="props.activity.team_id[1]" />
<t t-esc="props.activity.team_id.name" />
</td>
</tr>
</xpath>
Expand Down
Loading