diff options
| author | Xavier Dubuc <xdu@odoo.com> | 2020-11-02 11:31:13 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-11-02 11:31:13 +0000 |
| commit | 03481fd3df9bc53a17ba884ad4029ae46d7e54bf (patch) | |
| tree | 4e374aad0a7a6c845ee605b77cbe4e282efb7391 /addons/mail/static/src/models/composer/composer.js | |
| parent | b3e31f2680534382b048324cfcb8a6f6c457553f (diff) | |
[FIX] mail: handle transient messages with (un)seen notions
task-2343887
closes odoo/odoo#60906
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/composer/composer.js')
| -rw-r--r-- | addons/mail/static/src/models/composer/composer.js | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/addons/mail/static/src/models/composer/composer.js b/addons/mail/static/src/models/composer/composer.js index a18c78d3a2e..b81e5b165ab 100644 --- a/addons/mail/static/src/models/composer/composer.js +++ b/addons/mail/static/src/models/composer/composer.js @@ -269,25 +269,34 @@ function factory(dependencies) { if (thread.model === 'mail.channel') { const command = this._getCommandFromText(body); Object.assign(postData, { - command: command ? command.name : undefined, - subtype_xmlid: 'mail.mt_comment' + subtype_xmlid: 'mail.mt_comment', }); - messageId = await this.async(() => this.env.services.rpc({ - model: 'mail.channel', - method: command ? 'execute_command' : 'message_post', - args: [thread.id], - kwargs: postData, - })); + if (command) { + messageId = await this.async(() => this.env.models['mail.thread'].performRpcExecuteCommand({ + channelId: thread.id, + command: command.name, + postData, + })); + } else { + messageId = await this.async(() => + this.env.models['mail.thread'].performRpcMessagePost({ + postData, + threadId: thread.id, + threadModel: thread.model, + }) + ); + } } else { Object.assign(postData, { subtype_xmlid: this.isLog ? 'mail.mt_note' : 'mail.mt_comment', }); - messageId = await this.async(() => this.env.services.rpc({ - model: thread.model, - method: 'message_post', - args: [thread.id], - kwargs: postData, - })); + messageId = await this.async(() => + this.env.models['mail.thread'].performRpcMessagePost({ + postData, + threadId: thread.id, + threadModel: thread.model, + }) + ); const [messageData] = await this.async(() => this.env.services.rpc({ model: 'mail.message', method: 'message_format', |
