mirror of https://github.com/OCA/social.git
[MIG] mail_activity_board: Migration to 17.0
parent
86119fada0
commit
b24e056551
|
@ -4,7 +4,7 @@
|
|||
{
|
||||
"name": "Mail Activity Board",
|
||||
"summary": "Add Activity Boards",
|
||||
"version": "16.0.1.1.1",
|
||||
"version": "17.0.1.0.0",
|
||||
"development_status": "Beta",
|
||||
"category": "Social Network",
|
||||
"website": "https://github.com/OCA/social",
|
||||
|
@ -15,8 +15,8 @@
|
|||
"data": ["security/groups.xml", "views/mail_activity_view.xml"],
|
||||
"assets": {
|
||||
"web.assets_backend": [
|
||||
"mail_activity_board/static/src/components/chatter_topbar/chatter_topbar.esm.js",
|
||||
"mail_activity_board/static/src/components/chatter_topbar/chatter_topbar.xml",
|
||||
"mail_activity_board/static/src/components/chatter/chatter.esm.js",
|
||||
"mail_activity_board/static/src/components/chatter/chatter.xml",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<?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">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/** @odoo-module **/
|
||||
import {Chatter} from "@mail/core/web/chatter";
|
||||
import {patch} from "@web/core/utils/patch";
|
||||
|
||||
patch(Chatter.prototype, {
|
||||
// --------------------------------------------------------------------------
|
||||
// Handlers
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {MouseEvent} ev
|
||||
*/
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
async _onListActivity(ev) {
|
||||
if (this.state.thread) {
|
||||
const thread = this.state.thread;
|
||||
const action = await this.orm.call(
|
||||
thread.model,
|
||||
"redirect_to_activities",
|
||||
[[]],
|
||||
{
|
||||
id: this.state.thread.id,
|
||||
model: this.state.thread.model,
|
||||
}
|
||||
);
|
||||
this.action.doAction(action, {
|
||||
onClose: () => {
|
||||
thread.refreshActivities();
|
||||
thread.refresh();
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
|
@ -1,20 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t
|
||||
t-name="ChatterTopbar"
|
||||
t-inherit="mail.ChatterTopbar"
|
||||
t-name="mail_activity_board.Chatter"
|
||||
t-inherit="mail.Chatter"
|
||||
t-inherit-mode="extension"
|
||||
owl="1"
|
||||
>
|
||||
<t t-if="chatterTopbar.chatter.hasActivities" position="after">
|
||||
<xpath expr="//button[hasclass('o-mail-Chatter-activity')]" position="after">
|
||||
<button
|
||||
class="btn btn-link o_ChatterTopbar_button"
|
||||
type="button"
|
||||
t-att-disabled="!chatterTopbar.chatter.hasWriteAccess"
|
||||
t-att-disabled="!state.thread.hasWriteAccess"
|
||||
t-on-click="_onListActivity"
|
||||
>
|
||||
<i class="fa fa-list" /> View Activities
|
||||
</button>
|
||||
</t>
|
||||
</xpath>
|
||||
</t>
|
||||
</templates>
|
|
@ -1,45 +0,0 @@
|
|||
/** @odoo-module **/
|
||||
import {ChatterTopbar} from "@mail/components/chatter_topbar/chatter_topbar";
|
||||
import {bus} from "web.core";
|
||||
import {patch} from "@web/core/utils/patch";
|
||||
const components = {ChatterTopbar};
|
||||
// Import {rpc}
|
||||
import rpc from "web.rpc";
|
||||
|
||||
patch(
|
||||
components.ChatterTopbar.prototype,
|
||||
"mail_activity_board/static/src/components/chatter_topbar/chatter_topbar.esm.js",
|
||||
{
|
||||
// --------------------------------------------------------------------------
|
||||
// Handlers
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {MouseEvent} ev
|
||||
*/
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
async _onListActivity(ev) {
|
||||
rpc.query({
|
||||
model: this.chatterTopbar.chatter.thread.model,
|
||||
method: "redirect_to_activities",
|
||||
args: [[]],
|
||||
kwargs: {
|
||||
id: this.chatterTopbar.chatter.thread.id,
|
||||
model: this.chatterTopbar.chatter.thread.model,
|
||||
},
|
||||
context: {},
|
||||
}).then(function (action) {
|
||||
bus.trigger("do-action", {
|
||||
action,
|
||||
options: {
|
||||
on_close: () => {
|
||||
this.chatterTopbar.chatter.thread.refreshActivities();
|
||||
this.chatterTopbar.chatter.thread.refresh();
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
);
|
|
@ -5,7 +5,7 @@ from odoo.tests.common import TransactionCase
|
|||
|
||||
class TestMailActivityBoardMethods(TransactionCase):
|
||||
def setUp(self):
|
||||
super(TestMailActivityBoardMethods, self).setUp()
|
||||
super().setUp()
|
||||
# Set up activities
|
||||
|
||||
# Create a user as 'Crm Salesman' and added few groups
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<field name="activity_type_id" position="before">
|
||||
<field
|
||||
name="related_model_instance"
|
||||
attrs="{'invisible': [('related_model_instance','=', False)]}"
|
||||
invisible="not related_model_instance"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
|
@ -78,25 +78,24 @@
|
|||
<group>
|
||||
<field
|
||||
name="date_deadline"
|
||||
attrs="{'invisible': [('activity_category', '=', 'meeting')]}"
|
||||
invisible="activity_category == 'meeting'"
|
||||
/>
|
||||
<field
|
||||
name="calendar_event_id_start"
|
||||
string="Start meeting"
|
||||
attrs="{'invisible': [('calendar_event_id','=', False)]}"
|
||||
invisible="not calendar_event_id"
|
||||
/>
|
||||
<field
|
||||
name="duration"
|
||||
widget="float_time"
|
||||
attrs="{'invisible': ['|',('duration', '=', False),
|
||||
('calendar_event_id','=', False)]}"
|
||||
invisible="not duration or not calendar_event_id"
|
||||
/>
|
||||
<field name="user_id" options="{'no_open': True}" />
|
||||
|
||||
</group>
|
||||
</group>
|
||||
<group
|
||||
attrs="{'invisible': ['|',('calendar_event_id','=', False),('calendar_event_id_partner_ids','=', False)]}"
|
||||
invisible="not calendar_event_id or not calendar_event_id_partner_ids"
|
||||
>
|
||||
<field name="calendar_event_id_partner_ids" mode="kanban" />
|
||||
</group>
|
||||
|
|
Loading…
Reference in New Issue