diff --git a/mail_activity_board/__manifest__.py b/mail_activity_board/__manifest__.py index 8ef26e0e9..84789c117 100644 --- a/mail_activity_board/__manifest__.py +++ b/mail_activity_board/__manifest__.py @@ -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", ], }, } diff --git a/mail_activity_board/static/description/index.html b/mail_activity_board/static/description/index.html index c1f353c57..b9b5b2b3e 100644 --- a/mail_activity_board/static/description/index.html +++ b/mail_activity_board/static/description/index.html @@ -1,4 +1,3 @@ - diff --git a/mail_activity_board/static/src/components/chatter/chatter.esm.js b/mail_activity_board/static/src/components/chatter/chatter.esm.js new file mode 100644 index 000000000..cf1514023 --- /dev/null +++ b/mail_activity_board/static/src/components/chatter/chatter.esm.js @@ -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(); + }, + }); + } + }, +}); diff --git a/mail_activity_board/static/src/components/chatter_topbar/chatter_topbar.xml b/mail_activity_board/static/src/components/chatter/chatter.xml similarity index 62% rename from mail_activity_board/static/src/components/chatter_topbar/chatter_topbar.xml rename to mail_activity_board/static/src/components/chatter/chatter.xml index 4f176c480..7aaf27eb1 100644 --- a/mail_activity_board/static/src/components/chatter_topbar/chatter_topbar.xml +++ b/mail_activity_board/static/src/components/chatter/chatter.xml @@ -1,20 +1,19 @@ - + - + diff --git a/mail_activity_board/static/src/components/chatter_topbar/chatter_topbar.esm.js b/mail_activity_board/static/src/components/chatter_topbar/chatter_topbar.esm.js deleted file mode 100644 index 6dce776a9..000000000 --- a/mail_activity_board/static/src/components/chatter_topbar/chatter_topbar.esm.js +++ /dev/null @@ -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(); - }, - }, - }); - }); - }, - } -); diff --git a/mail_activity_board/tests/test_mail_activity_board.py b/mail_activity_board/tests/test_mail_activity_board.py index d268bf2c8..08132bfb0 100644 --- a/mail_activity_board/tests/test_mail_activity_board.py +++ b/mail_activity_board/tests/test_mail_activity_board.py @@ -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 diff --git a/mail_activity_board/views/mail_activity_view.xml b/mail_activity_board/views/mail_activity_view.xml index 9b9429ae4..65587c95e 100644 --- a/mail_activity_board/views/mail_activity_view.xml +++ b/mail_activity_board/views/mail_activity_view.xml @@ -18,7 +18,7 @@ @@ -78,25 +78,24 @@