diff --git a/mail_base/static/src/js/base.js b/mail_base/static/src/js/base.js index 8a4a7f4..00eb61f 100644 --- a/mail_base/static/src/js/base.js +++ b/mail_base/static/src/js/base.js @@ -797,12 +797,15 @@ chat_manager.post_message = function (data, options) { }); } else { options.model = 'mail.compose.message'; - options.res_id = msg.id; var compose_model = new Model(options.model); - return compose_model.call('send_mail_action', [options.res_id], { + return compose_model.call('send_mail_action', [options.res_id, { res_model: options.model, - res_id: options.res_id - }); + res_id: options.res_id, + context: { + default_parent_id: options.parent_id + } + + }]); } } }; diff --git a/mail_reply/static/src/js/mail_reply.js b/mail_reply/static/src/js/mail_reply.js index 8957248..b1a023f 100644 --- a/mail_reply/static/src/js/mail_reply.js +++ b/mail_reply/static/src/js/mail_reply.js @@ -16,6 +16,30 @@ ChatAction.include({ subject = "Re: " + message.subject; } this.extended_composer.set_subject(subject); + }, + on_post_message: function(message){ + var self = this; + var options = this.selected_message ? {} : {channel_id: this.channel.id}; + if (this.selected_message) { + message.subtype = 'mail.mt_comment'; + message.subtype_id = false; + message.message_type = 'comment'; + message.content_subtype = 'html'; + + options.model = this.selected_message.model; + options.res_id = this.selected_message.res_id; + options.parent_id = this.selected_message.id; + } + base_obj.chat_manager + .post_message(message, options) + .then(function() { + if (self.selected_message) { + self.render_snackbar('mail.chat.MessageSentSnackbar', {record_name: self.selected_message.record_name}, 5000); + self.unselect_message(); + } else { + self.thread.scroll_to(); + } + }); } });