[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.
This commit is contained in:
sha-odoo
2015-04-27 10:16:35 +02:00
committed by Thibault Delavallée
parent a92456fe8b
commit 817fc0a8d7
+8 -1
View File
@@ -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);
},