diff --git a/mail_to/models/mail_message.py b/mail_to/models/mail_message.py index c827072f..f7a75f49 100644 --- a/mail_to/models/mail_message.py +++ b/mail_to/models/mail_message.py @@ -6,6 +6,18 @@ class MailMessage(models.Model): _inherit = 'mail.message' + # взято с mail_base + @api.multi + def write(self, values): + if values.get('needaction_partner_ids'): + if not values.get('partner_ids'): + values['partner_ids'] = [] + for triplet in values.get('needaction_partner_ids'): + if triplet[0] == 6: + for i in triplet[2]: + values['partner_ids'].append((4, i, False)) + return super(MailMessage, self).write(values) + @api.multi def message_format(self): messages_values = super(MailMessage, self).message_format() diff --git a/mail_to/static/src/js/mail_to.js b/mail_to/static/src/js/mail_to.js index 665ee256..88031d57 100644 --- a/mail_to/static/src/js/mail_to.js +++ b/mail_to/static/src/js/mail_to.js @@ -6,13 +6,14 @@ odoo.define('mail_to.MailTo', function (require) { "use strict"; -var chat_manager = require('mail_base.base').chat_manager; + var MailManager = require("mail.Manager"); + MailManager.include({ + _makeMessage: function(data) { + var msg = this._super(data); -var make_message_super = chat_manager.make_message; -chat_manager.make_message = function (data) { - var msg = make_message_super.call(this, data); msg.partner_ids = data.partner_ids; msg.channel_names = data.channel_names; + msg.channel_ids = data.channel_ids; msg.recipients = data.partner_ids.concat(data.channel_names); if (!msg.partner_ids && !msg.channel_names) { return msg; @@ -34,7 +35,8 @@ chat_manager.make_message = function (data) { msg.more_recipients = more_recipients; return msg; - }; + } + }); - return chat_manager; + return MailManager; }); diff --git a/mail_to/static/src/xml/recipient.xml b/mail_to/static/src/xml/recipient.xml index 312240a5..cfa3ac2d 100644 --- a/mail_to/static/src/xml/recipient.xml +++ b/mail_to/static/src/xml/recipient.xml @@ -5,7 +5,7 @@ License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).-->