From e67caee72c28d140594a0c3785f2aed24bf82746 Mon Sep 17 00:00:00 2001 From: ommo73 Date: Sat, 26 Oct 2019 17:15:39 +0500 Subject: [PATCH] :ambulance: mail_to: fixing errors --- mail_to/models/mail_message.py | 11 +++++++++++ mail_to/static/src/js/mail_to.js | 13 +++++++------ mail_to/static/src/xml/recipient.xml | 14 +++++++------- mail_to/templates.xml | 1 + 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/mail_to/models/mail_message.py b/mail_to/models/mail_message.py index c827072f..a5dcc56b 100644 --- a/mail_to/models/mail_message.py +++ b/mail_to/models/mail_message.py @@ -6,6 +6,17 @@ class MailMessage(models.Model): _inherit = 'mail.message' + @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..7a9d42d4 100644 --- a/mail_to/static/src/js/mail_to.js +++ b/mail_to/static/src/js/mail_to.js @@ -6,11 +6,11 @@ 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.recipients = data.partner_ids.concat(data.channel_names); @@ -34,7 +34,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..3edcf12b 100644 --- a/mail_to/static/src/xml/recipient.xml +++ b/mail_to/static/src/xml/recipient.xml @@ -5,28 +5,28 @@ License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).-->