Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mail_to: return back broken features #2

Open
wants to merge 3 commits into
base: 12.0-mail_addons-merge
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions mail_to/models/mail_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
14 changes: 8 additions & 6 deletions mail_to/static/src/js/mail_to.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,7 +35,8 @@ chat_manager.make_message = function (data) {

msg.more_recipients = more_recipients;
return msg;
};
}
});

return chat_manager;
return MailManager;
});
6 changes: 3 additions & 3 deletions mail_to/static/src/xml/recipient.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).-->
<template>
<t t-extend="mail.widget.Thread.Message">
<t t-jquery="p[class=o_mail_info] span:last" t-operation="after">
<t t-jquery="p.o_mail_info span:last" t-operation="after">
<span class="recipients_info"><t t-if="message.partner_ids">
<t t-if="message.partner_ids.length > 0">To: </t>
<t t-else="message.channel_ids.length > 0">To: </t>
Expand All @@ -15,9 +15,9 @@
<i t-esc="message.partner_ids[i][1]"/><t t-if="i &lt; message.partner_ids.length - 1">; </t><t t-else="message.channel_ids.length > 0 and message.partner_ids.length &lt; 4">; </t>
</a>
</t>
<t t-if="partner_ids.length &gt; 4">
<t t-if="message.partner_ids.length &gt; 4">
<span t-att-title="more_recipients">
and <t t-esc="partner_ids.length - 4"/> more
and <t t-esc="message.partner_ids.length - 4"/> more
</span>
</t>

Expand Down
1 change: 1 addition & 0 deletions mail_to/templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<xpath expr="." position="inside">
<link rel="stylesheet" href="/mail_to/static/src/css/mail_to.css"/>
<script src="/mail_to/static/src/js/mail_to.js" type="text/javascript"></script>
</xpath>
</template>
</data>
</openerp>