From 817fc0a8d7bd62cf614b453af47ec49703801eee Mon Sep 17 00:00:00 2001 From: sha-odoo Date: Thu, 9 Apr 2015 10:41:50 +0530 Subject: [PATCH] [IMP] mail: compose message button on header is now contextual. This means that you can post a message using the full composer on a document that has a chatter. This is a shortcut to scroll down / send a message / toggle full composer. The use case is for example to send an email on an issue or an applicant, using a template. --- addons/mail/static/src/js/mail.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index aa277c0e8e5..6bd7ba36378 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -1970,6 +1970,13 @@ var ComposeMessageTopButton = Widget.extend({ }, on_compose_message: function (ev) { ev.preventDefault(); + var ctx = {} + if ($('a.oe_compose_post') && $('a.oe_compose_post').is(":visible") == true && (this.getParent()).getParent().action_manager.inner_widget.active_view.type == 'form'){ + ctx = { + 'default_res_id': (this.getParent()).getParent().action_manager.inner_widget.active_view.controller.datarecord.id, + 'default_model': (this.getParent()).getParent().action_manager.inner_widget.active_view.controller.model, + } + } var action = { type: 'ir.actions.act_window', res_model: 'mail.compose.message', @@ -1977,7 +1984,7 @@ var ComposeMessageTopButton = Widget.extend({ view_type: 'form', views: [[false, 'form']], target: 'new', - context: {}, + context: ctx, }; web_client.action_manager.do_action(action); },