diff --git a/addons/mail/static/src/js/client_action.js b/addons/mail/static/src/js/client_action.js
index a0c22add842..a1882fa2773 100644
--- a/addons/mail/static/src/js/client_action.js
+++ b/addons/mail/static/src/js/client_action.js
@@ -191,6 +191,7 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
chat_manager.mark_all_as_read();
});
this.$buttons.on('click', '.o_mail_chat_button_unstar_all', chat_manager.unstar_all);
+ this.$buttons.on('click', '.o_mail_chat_button_new_message', this.on_click_new_message);
this.thread.on('redirect', this, function (res_model, res_id) {
chat_manager.redirect(res_model, res_id, this.set_channel.bind(this));
@@ -375,7 +376,7 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
.find('.o_mail_chat_button_invite, .o_mail_chat_button_unsubscribe, .o_mail_chat_button_settings')
.toggle(channel.type !== "dm" && channel.type !== 'static');
self.$buttons
- .find('.o_mail_chat_button_mark_read')
+ .find('.o_mail_chat_button_mark_read, .o_mail_chat_button_new_message')
.toggle(channel.id === "channel_inbox");
self.$buttons
.find('.o_mail_chat_button_unstar_all')
@@ -591,6 +592,16 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
target: 'current'
});
},
+ on_click_new_message: function () {
+ this.do_action({
+ type: 'ir.actions.act_window',
+ res_model: 'mail.compose.message',
+ view_mode: 'form',
+ view_type: 'form',
+ views: [[false, 'form']],
+ target: 'new',
+ });
+ },
});
diff --git a/addons/mail/static/src/js/systray.js b/addons/mail/static/src/js/systray.js
index 19e225c364f..293521ec045 100644
--- a/addons/mail/static/src/js/systray.js
+++ b/addons/mail/static/src/js/systray.js
@@ -3,7 +3,6 @@ odoo.define('mail.systray', function (require) {
var core = require('web.core');
var SystrayMenu = require('web.SystrayMenu');
-var web_client = require('web.web_client');
var Widget = require('web.Widget');
var chat_manager = require('mail.chat_manager');
@@ -41,33 +40,4 @@ var NotificationTopButton = Widget.extend({
SystrayMenu.Items.push(NotificationTopButton);
-
-
-/**
- * * Global ComposeMessage Top Button
- * *
- * * Add a link on the top user bar to write a full mail. It opens the form view
- * * of the mail.compose.message (in a modal).
- * */
-var ComposeMessageTopButton = Widget.extend({
- template:'mail.ComposeMessageTopButton',
- events: {
- "click": "on_compose_message",
- },
- on_compose_message: function (ev) {
- ev.preventDefault();
- web_client.action_manager.do_action({
- type: 'ir.actions.act_window',
- res_model: 'mail.compose.message',
- view_mode: 'form',
- view_type: 'form',
- views: [[false, 'form']],
- target: 'new',
- });
- },
-});
-
-// Put the ComposeMessageTopButton widget in the systray menu
-SystrayMenu.Items.push(ComposeMessageTopButton);
-
});
diff --git a/addons/mail/static/src/xml/client_action.xml b/addons/mail/static/src/xml/client_action.xml
index ac60afc3e58..55be6233d22 100644
--- a/addons/mail/static/src/xml/client_action.xml
+++ b/addons/mail/static/src/xml/client_action.xml
@@ -124,6 +124,7 @@
+
diff --git a/addons/mail/static/src/xml/systray.xml b/addons/mail/static/src/xml/systray.xml
index 5318f30b3dd..e503f87e095 100644
--- a/addons/mail/static/src/xml/systray.xml
+++ b/addons/mail/static/src/xml/systray.xml
@@ -1,12 +1,5 @@
-
-
-
-
-
-
-