summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/mail.js
diff options
context:
space:
mode:
authorsha-odoo <sha@odoo.com>2015-04-09 10:41:50 +0530
committerThibault Delavallée <tde@openerp.com>2015-04-27 10:16:35 +0200
commit817fc0a8d7bd62cf614b453af47ec49703801eee (patch)
tree3488fda8e196a944f87fd3f0de650bbd000bbded /addons/mail/static/src/js/mail.js
parenta92456fe8b0b625f4e9b3c9495bbfbc80c3e44b5 (diff)
[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.
Diffstat (limited to 'addons/mail/static/src/js/mail.js')
-rw-r--r--addons/mail/static/src/js/mail.js9
1 files changed, 8 insertions, 1 deletions
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);
},