Browse Source

🚑 mail_to: fixing errors

pull/246/head
ommo73 5 years ago
parent
commit
1d415a2b1b
No known key found for this signature in database GPG Key ID: E7E1F5C23505AFF8
  1. 3
      mail_to/doc/changelog.rst
  2. 5
      mail_to/i18n/de.po
  3. 66
      mail_to/i18n/mail_to.pot
  4. 8
      mail_to/i18n/sl.po
  5. 11
      mail_to/models/mail_message.py
  6. 23
      mail_to/static/src/js/mail_to.js
  7. 20
      mail_to/static/src/js/test_mail_to.js
  8. 29
      mail_to/static/src/xml/recipient.xml
  9. 3
      mail_to/templates.xml

3
mail_to/doc/changelog.rst

@ -1,8 +1,7 @@
`1.1.0` `1.1.0`
------- -------
- **New**: Channels are displayed in recipients
- **New**: channels are displayed in recipients
`1.0.1` `1.0.1`
------- -------

5
mail_to/i18n/de.po

@ -13,12 +13,7 @@ msgstr ""
"POT-Creation-Date: 2018-05-05 23:09+0000\n" "POT-Creation-Date: 2018-05-05 23:09+0000\n"
"PO-Revision-Date: 2018-04-21 00:05+0000\n" "PO-Revision-Date: 2018-04-21 00:05+0000\n"
"Last-Translator: Ermin Trevisan <trevi@twanda.com>, 2019\n" "Last-Translator: Ermin Trevisan <trevi@twanda.com>, 2019\n"
<<<<<<< HEAD
"Language-Team: German (https://www.transifex.com/it-projects-llc/teams/76080/de/)\n" "Language-Team: German (https://www.transifex.com/it-projects-llc/teams/76080/de/)\n"
=======
"Language-Team: German (https://www.transifex.com/it-projects-llc/teams/76080/"
"de/)\n"
>>>>>>> upstream/11.0
"Language: de\n" "Language: de\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"

66
mail_to/i18n/mail_to.pot

@ -1,66 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_to
#
msgid ""
msgstr ""
<<<<<<< HEAD
"Project-Id-Version: Odoo Server 12.0\n"
=======
"Project-Id-Version: Odoo Server 11.0\n"
>>>>>>> upstream/11.0
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: mail_to
<<<<<<< HEAD
#. openerp-web
#: code:addons/mail_to/static/src/xml/recipient.xml:10
=======
#: model:ir.model,name:mail_to.model_mail_message
msgid "Message"
msgstr ""
#. module: mail_to
#. openerp-web
#: code:addons/mail_to/static/src/js/test_mail_to.js:13
#, python-format
msgid "Open Partners Form From Recipient Link"
msgstr ""
#. module: mail_to
#. openerp-web
#: code:addons/mail_to/static/src/xml/recipient.xml:10
#: code:addons/mail_to/static/src/xml/recipient.xml:11
>>>>>>> upstream/11.0
#, python-format
msgid "To:"
msgstr ""
#. module: mail_to
#. openerp-web
<<<<<<< HEAD
#: code:addons/mail_to/static/src/xml/recipient.xml:19
=======
#: code:addons/mail_to/static/src/xml/recipient.xml:32
>>>>>>> upstream/11.0
#, python-format
msgid "and"
msgstr ""
#. module: mail_to
#. openerp-web
<<<<<<< HEAD
#: code:addons/mail_to/static/src/xml/recipient.xml:20
=======
#: code:addons/mail_to/static/src/xml/recipient.xml:33
>>>>>>> upstream/11.0
#, python-format
msgid "more"
msgstr ""

8
mail_to/i18n/sl.po

@ -12,14 +12,12 @@ msgstr ""
"POT-Creation-Date: 2018-05-05 23:09+0000\n" "POT-Creation-Date: 2018-05-05 23:09+0000\n"
"PO-Revision-Date: 2018-04-21 00:05+0000\n" "PO-Revision-Date: 2018-04-21 00:05+0000\n"
"Last-Translator: Matjaz Mozetic <m.mozetic@matmoz.si>, 2019\n" "Last-Translator: Matjaz Mozetic <m.mozetic@matmoz.si>, 2019\n"
"Language-Team: Slovenian (https://www.transifex.com/it-projects-llc/"
"teams/76080/sl/)\n"
"Language: sl\n"
"Language-Team: Slovenian (https://www.transifex.com/it-projects-llc/teams/76080/sl/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n" "Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
"%100==4 ? 2 : 3);\n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: mail_to #. module: mail_to
#. openerp-web #. openerp-web

11
mail_to/models/mail_message.py

@ -13,5 +13,16 @@ class MailMessage(models.Model):
if i['channel_ids']: if i['channel_ids']:
i['channel_names'] = self.env['mail.channel'].browse(i['channel_ids']).mapped( i['channel_names'] = self.env['mail.channel'].browse(i['channel_ids']).mapped(
lambda r: [r.id, '#' + r.display_name]) lambda r: [r.id, '#' + r.display_name])
else:
i['channel_names'] = []
partner_ids = set(i['needaction_partner_ids'])
partner_ids.update(set(map(lambda x: x[0], i['partner_ids'])))
partner_ids.update(set(map(lambda x: x[0], i['customer_email_data'])))
if partner_ids:
i['partner_names'] = self.env['res.partner'].browse(partner_ids).mapped(
lambda r: [r.id, r.name])
else:
i['partner_names'] = []
return messages_values return messages_values

23
mail_to/static/src/js/mail_to.js

@ -6,15 +6,16 @@
odoo.define('mail_to.MailTo', function (require) { odoo.define('mail_to.MailTo', function (require) {
"use strict"; "use strict";
var chat_manager = require('mail_base.base').chat_manager;
var MailManager = require("mail.Manager");
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;
MailManager.include({
_makeMessage: function(data) {
var msg = this._super(data);
msg.partner_names = data.partner_names;
msg.channel_names = data.channel_names; msg.channel_names = data.channel_names;
msg.recipients = data.partner_ids.concat(data.channel_names);
if (!msg.partner_ids && !msg.channel_names) {
msg.recipients = msg.partner_names.concat(msg.channel_names);
if (!msg.partner_names && !msg.channel_names) {
return msg; return msg;
} }
@ -27,14 +28,16 @@ chat_manager.make_message = function (data) {
more_recipients += msg.recipients[i][1]; more_recipients += msg.recipients[i][1];
// separate them with semicolon // separate them with semicolon
if (i < msg.recipients.length - 1){ if (i < msg.recipients.length - 1){
more_recipients += '; ';
more_recipients += ', ';
} }
} }
} }
msg.more_recipients = more_recipients; msg.more_recipients = more_recipients;
return msg; return msg;
};
}
});
return chat_manager;
return MailManager;
}); });

20
mail_to/static/src/js/test_mail_to.js

@ -1,20 +0,0 @@
/* Copyright 2018 Artem Rafailov <https://it-projects.info/team/KolushovAlexandr>
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).*/
odoo.define('mail_to.tour', function (require) {
"use strict";
var tour = require("web_tour.tour");
var core = require('web.core');
var _t = core._t;
var email = 'mail_private test email';
var steps = [{
trigger: 'a.recipient_link:first',
content: _t("Open Partners Form From Recipient Link"),
position: 'bottom',
timeout: 70000,
}];
tour.register('mail_to_tour', { test: true, url: '/web' }, steps);
});

29
mail_to/static/src/xml/recipient.xml

@ -5,28 +5,24 @@
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).--> License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).-->
<template> <template>
<t t-extend="mail.widget.Thread.Message"> <t t-extend="mail.widget.Thread.Message">
<t t-jquery="p[class=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>
<t t-foreach="message.partner_ids.length" t-as="i">
<t t-jquery="p.o_mail_info" t-operation="append">
<span class="recipients_info">
<t t-if="message.partner_names or message.channel_names">
<t t-if="message.partner_names.length > 0">To: </t>
<t t-else="message.channel_names.length > 0">To: </t>
<t t-foreach="message.partner_names.length" t-as="i">
<t t-if="i &lt; message.more_recipients_value"> <t t-if="i &lt; message.more_recipients_value">
<a t-att-href="_.str.sprintf('/web?#id=%s&amp;view_type=form&amp;model=res.partner', message.partner_ids[i][0])" class="recipient_link">
<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-att-href="_.str.sprintf('/web?#id=%s&amp;view_type=form&amp;model=res.partner', message.partner_names[i][0])" class="recipient_link">
<i t-esc="message.partner_names[i][1]"/><t t-if="i &lt; message.partner_names.length - 1">, </t><t t-else="message.channel_names.length > 0 and message.partner_names.length &lt; 4">; </t>
</a> </a>
</t> </t>
<t t-if="partner_ids.length &gt; 4">
<span t-att-title="more_recipients">
and <t t-esc="partner_ids.length - 4"/> more
</span>
</t> </t>
</t>
<t t-if="message.channel_names"> <t t-if="message.channel_names">
<t t-foreach="message.channel_ids.length" t-as="i">
<t t-if="message.partner_ids.length &lt; message.more_recipients_value and (message.partner_ids.length + i) &lt; message.more_recipients_value">
<t t-foreach="message.channel_names.length" t-as="i">
<t t-if="message.partner_names.length &lt; message.more_recipients_value and (message.partner_names.length + i) &lt; message.more_recipients_value">
<a t-if="message.channel_names[i]" t-att-href="_.str.sprintf('/web?#id=%s&amp;view_type=form&amp;model=mail.channel', message.channel_names[i][0])" class="recipient_link"> <a t-if="message.channel_names[i]" t-att-href="_.str.sprintf('/web?#id=%s&amp;view_type=form&amp;model=mail.channel', message.channel_names[i][0])" class="recipient_link">
<i t-esc="message.channel_names[i][1]"/><t t-if="i &lt; message.channel_ids.length - 1">; </t>
<i t-esc="message.channel_names[i][1]"/><t t-if="i &lt; message.channel_names.length - 1">, </t>
</a> </a>
</t> </t>
</t> </t>
@ -38,7 +34,8 @@
and <t t-esc="message.recipients.length - message.more_recipients_value"/> more and <t t-esc="message.recipients.length - message.more_recipients_value"/> more
</span> </span>
</t> </t>
</t></span>
</t>
</span>
</t> </t>
</t> </t>
</template> </template>

3
mail_to/templates.xml

@ -10,7 +10,8 @@
inherit_id="web.assets_backend"> inherit_id="web.assets_backend">
<xpath expr="." position="inside"> <xpath expr="." position="inside">
<link rel="stylesheet" href="/mail_to/static/src/css/mail_to.css"/> <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>
<script src="/mail_to/static/src/js/mail_to.js" type="text/javascript"/>
</xpath>
</template> </template>
</data> </data>
</openerp> </openerp>
Loading…
Cancel
Save