[MIG] mail_activity_board: Migration to 16.0
This commit is contained in:
parent
cf30a1598f
commit
dcc0c7277c
@ -4,20 +4,18 @@
|
||||
{
|
||||
"name": "Mail Activity Board",
|
||||
"summary": "Add Activity Boards",
|
||||
"version": "15.0.1.1.1",
|
||||
"version": "16.0.1.0.0",
|
||||
"development_status": "Beta",
|
||||
"category": "Social Network",
|
||||
"website": "https://github.com/OCA/social",
|
||||
"author": "SDi, David Juaneda, Sodexis, ACSONE SA/NV, Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"installable": True,
|
||||
"depends": ["calendar", "board"],
|
||||
"depends": ["calendar", "spreadsheet_dashboard"],
|
||||
"data": ["views/mail_activity_view.xml"],
|
||||
"assets": {
|
||||
"web.assets_backend": [
|
||||
"mail_activity_board/static/src/components/chatter_topbar/chatter_topbar.esm.js",
|
||||
],
|
||||
"web.assets_qweb": [
|
||||
"mail_activity_board/static/src/components/chatter_topbar/chatter_topbar.xml",
|
||||
],
|
||||
},
|
||||
|
@ -1,6 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
import {patch} from "web.utils";
|
||||
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";
|
||||
@ -18,24 +19,23 @@ patch(
|
||||
* @param {MouseEvent} ev
|
||||
*/
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
_onListActivity(ev) {
|
||||
var self = this;
|
||||
async _onListActivity(ev) {
|
||||
rpc.query({
|
||||
model: this.chatter.thread.model,
|
||||
model: this.chatterTopbar.chatter.thread.model,
|
||||
method: "redirect_to_activities",
|
||||
args: [[]],
|
||||
kwargs: {
|
||||
id: this.chatter.thread.id,
|
||||
model: this.chatter.thread.model,
|
||||
id: this.chatterTopbar.chatter.thread.id,
|
||||
model: this.chatterTopbar.chatter.thread.model,
|
||||
},
|
||||
context: {},
|
||||
}).then(function (action) {
|
||||
self.env.bus.trigger("do-action", {
|
||||
bus.trigger("do-action", {
|
||||
action,
|
||||
options: {
|
||||
on_close: () => {
|
||||
this.chatter.thread.refreshActivities();
|
||||
this.chatter.thread.refresh();
|
||||
this.chatterTopbar.chatter.thread.refreshActivities();
|
||||
this.chatterTopbar.chatter.thread.refresh();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -1,19 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates xml:space="preserve">
|
||||
<t t-inherit="mail.ChatterTopbar" t-inherit-mode="extension">
|
||||
<xpath
|
||||
expr="//*[@class='btn btn-link o_ChatterTopbar_button o_ChatterTopbar_buttonScheduleActivity']"
|
||||
position="after"
|
||||
>
|
||||
<button
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t
|
||||
t-name="ChatterTopbar"
|
||||
t-inherit="mail.ChatterTopbar"
|
||||
t-inherit-mode="extension"
|
||||
owl="1"
|
||||
>
|
||||
<t t-if="chatterTopbar.chatter.hasActivities" position="after">
|
||||
<button
|
||||
class="btn btn-link o_ChatterTopbar_button"
|
||||
type="button"
|
||||
t-att-disabled="chatter.isDisabled"
|
||||
t-att-disabled="!chatterTopbar.chatter.hasWriteAccess"
|
||||
t-on-click="_onListActivity"
|
||||
>
|
||||
<i class="fa fa-list" />Activities
|
||||
</button>
|
||||
</xpath>
|
||||
<i class="fa fa-list" /> View Activities
|
||||
</button>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
|
@ -143,8 +143,8 @@ class TestMailActivityBoardMethods(TransactionCase):
|
||||
|
||||
def get_view(self, activity):
|
||||
action = activity.open_origin()
|
||||
result = self.env[action.get("res_model")].load_views(action.get("views"))
|
||||
return result.get("fields_views").get(action.get("view_mode"))
|
||||
result = self.env[action.get("res_model")].get_views(action.get("views"))
|
||||
return result.get("views").get(action.get("view_mode"))
|
||||
|
||||
def test_open_origin_res_partner(self):
|
||||
"""This test case checks
|
||||
@ -159,19 +159,19 @@ class TestMailActivityBoardMethods(TransactionCase):
|
||||
view = self.get_view(self.act1)
|
||||
|
||||
# Check the next view is correct
|
||||
self.assertEqual(form_view_partner_id, view.get("view_id"))
|
||||
self.assertEqual(form_view_partner_id, view.get("id"))
|
||||
|
||||
# Id of the form view return open_origin()
|
||||
view = self.get_view(self.act2)
|
||||
|
||||
# Check the next view is correct
|
||||
self.assertEqual(form_view_partner_id, view.get("view_id"))
|
||||
self.assertEqual(form_view_partner_id, view.get("id"))
|
||||
|
||||
# Id of the form view return open_origin()
|
||||
view = self.get_view(self.act3)
|
||||
|
||||
# Check the next view is correct
|
||||
self.assertEqual(form_view_partner_id, view.get("view_id"))
|
||||
self.assertEqual(form_view_partner_id, view.get("id"))
|
||||
|
||||
def test_redirect_to_activities(self):
|
||||
"""This test case checks
|
||||
@ -180,15 +180,19 @@ class TestMailActivityBoardMethods(TransactionCase):
|
||||
"""
|
||||
action_id = self.env.ref("mail_activity_board.open_boards_activities").id
|
||||
action = self.partner_client.redirect_to_activities(
|
||||
**{"id": self.partner_client.id}
|
||||
**{
|
||||
"id": self.partner_client.id,
|
||||
"model": self.partner_client._name,
|
||||
}
|
||||
)
|
||||
self.assertEqual(action.get("id"), action_id)
|
||||
|
||||
kwargs = {"groupby": ["activity_type_id"]}
|
||||
kwargs["domain"] = action.get("domain")
|
||||
|
||||
result = self.env[action.get("res_model")].load_views(action.get("views"))
|
||||
fields = result.get("fields_views").get("kanban").get("fields")
|
||||
result = self.env[action.get("res_model")].get_views(action.get("views"))
|
||||
# fields = result.get("views").get("kanban").get("fields")
|
||||
fields = result.get("models").get(action.get("res_model"))
|
||||
kwargs["fields"] = list(fields.keys())
|
||||
|
||||
result = self.env["mail.activity"].read_group(**kwargs)
|
||||
|
@ -196,17 +196,13 @@
|
||||
t-if="record.activity_category.raw_value!='meeting'"
|
||||
>
|
||||
<span t-attf-class="text-danger">
|
||||
<field
|
||||
name="date_deadline"
|
||||
t-options='{"widget": "date"}'
|
||||
/>
|
||||
<field name="date_deadline" />
|
||||
</span>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<span t-attf-class="text-danger">
|
||||
<field
|
||||
name="calendar_event_id_start"
|
||||
t-options='{"widget": "date"}'
|
||||
/>
|
||||
</span>
|
||||
</t>
|
||||
@ -220,17 +216,11 @@
|
||||
t-if="record.activity_category.raw_value!='meeting'"
|
||||
>
|
||||
<span>
|
||||
<field
|
||||
name="date_deadline"
|
||||
t-options='{"widget": "date"}'
|
||||
/>
|
||||
<field name="date_deadline" />
|
||||
</span>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<field
|
||||
name="calendar_event_id_start"
|
||||
t-options='{"widget": "date"}'
|
||||
/>
|
||||
<field name="calendar_event_id_start" />
|
||||
</t>
|
||||
</t>
|
||||
</div>
|
||||
@ -329,7 +319,7 @@ Menus
|
||||
<menuitem
|
||||
id="board_menu_activities"
|
||||
name="Activities"
|
||||
parent="base.menu_board_root"
|
||||
parent="spreadsheet_dashboard.spreadsheet_dashboard_menu_root"
|
||||
action="open_boards_activities"
|
||||
sequence="1"
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user