From 3141b19eb2771bfbf72f1871788b06027791e3bb Mon Sep 17 00:00:00 2001 From: x620 Date: Tue, 24 May 2016 15:15:34 +0500 Subject: [PATCH] [FIX] Add parent_id field in options in mail_reply.js and and add parent_id parameter in context in base.js --- mail_base/static/src/js/base.js | 11 +++++++---- mail_reply/static/src/js/mail_reply.js | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) 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(); + } + }); } });