Browse Source

Merge remote-tracking branch 'Eugene/12.0-mail_addons-merge-mail_to-fix' into 12.0-mail_to

Signed-off-by: Vildan Safin <safin@it-projects.info>
pull/299/head
Vildan Safin 4 years ago
parent
commit
fff8adcb4c
  1. 2
      mail_to/__init__.py
  2. 10
      mail_to/__manifest__.py
  3. 6
      mail_to/doc/changelog.rst
  4. 3
      mail_to/i18n/de.po
  5. 19
      mail_to/i18n/mail_to.pot
  6. 8
      mail_to/i18n/sl.po
  7. 1
      mail_to/models/__init__.py
  8. 29
      mail_to/models/mail_message.py
  9. 42
      mail_to/static/src/js/mail_to.js
  10. 20
      mail_to/static/src/js/test_mail_to.js
  11. 46
      mail_to/static/src/xml/recipient.xml
  12. 5
      mail_to/templates.xml
  13. 1
      mail_to/tests/__init__.py
  14. 7
      mail_to/tests/test_default.py

2
mail_to/__init__.py

@ -0,0 +1,2 @@
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
from . import models

10
mail_to/__manifest__.py

@ -1,9 +1,15 @@
# Copyright 2016 x620 <https://github.com/x620>
# Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2018 Ruslan Ronzhin
# Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
{ {
"name": """Show message recipients""", "name": """Show message recipients""",
"summary": """Allows you be sure, that all discussion participants were notified""", "summary": """Allows you be sure, that all discussion participants were notified""",
"category": "Discuss", "category": "Discuss",
"images": ["images/1.png"],
"version": "12.0.1.0.1",
"images": ['images/1.png'],
"version": "12.0.1.1.0",
"author": "IT-Projects LLC, Pavel Romanchenko", "author": "IT-Projects LLC, Pavel Romanchenko",
"support": "apps@itpp.dev", "support": "apps@itpp.dev",
"website": "https://it-projects.info", "website": "https://it-projects.info",

6
mail_to/doc/changelog.rst

@ -1,3 +1,9 @@
`1.1.0`
-------
- **New**: Channels are displayed in recipients
`1.0.1` `1.0.1`
------- -------

3
mail_to/i18n/de.po

@ -13,7 +13,8 @@ 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"
"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: 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"

19
mail_to/i18n/mail_to.pot

@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
@ -13,23 +13,36 @@ msgstr ""
"Content-Transfer-Encoding: \n" "Content-Transfer-Encoding: \n"
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: mail_to
#: 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 #. module: mail_to
#. openerp-web #. openerp-web
#: code:addons/mail_to/static/src/xml/recipient.xml:10 #: code:addons/mail_to/static/src/xml/recipient.xml:10
#: code:addons/mail_to/static/src/xml/recipient.xml:11
#, python-format #, python-format
msgid "To:" msgid "To:"
msgstr "" msgstr ""
#. module: mail_to #. module: mail_to
#. openerp-web #. openerp-web
#: code:addons/mail_to/static/src/xml/recipient.xml:24
#: code:addons/mail_to/static/src/xml/recipient.xml:32
#, python-format #, python-format
msgid "and" msgid "and"
msgstr "" msgstr ""
#. module: mail_to #. module: mail_to
#. openerp-web #. openerp-web
#: code:addons/mail_to/static/src/xml/recipient.xml:25
#: code:addons/mail_to/static/src/xml/recipient.xml:33
#, python-format #, python-format
msgid "more" msgid "more"
msgstr "" msgstr ""

8
mail_to/i18n/sl.po

@ -12,12 +12,14 @@ 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-Team: Slovenian (https://www.transifex.com/it-projects-llc/"
"teams/76080/sl/)\n"
"Language: 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"
"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"
"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

1
mail_to/models/__init__.py

@ -0,0 +1 @@
from . import mail_message

29
mail_to/models/mail_message.py

@ -0,0 +1,29 @@
# Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
from odoo import models, api
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()
for i in messages_values:
if i['channel_ids']:
i['channel_names'] = self.env['mail.channel'].browse(i['channel_ids']).mapped(
lambda r: [r.id, '#' + r.display_name])
return messages_values

42
mail_to/static/src/js/mail_to.js

@ -0,0 +1,42 @@
/* Copyright 2016 x620 <https://github.com/x620>
* Copyright 2016-2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
* Copyright 2017 Artyom Losev <https://it-projects.info/>
* Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). */
odoo.define('mail_to.MailTo', function (require) {
"use strict";
var MailManager = require("mail.Manager");
MailManager.include({
_makeMessage: function(data) {
var msg = this._super(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;
}
var more_recipients = '';
// value which define more recipients
msg.more_recipients_value = 4;
for (var i = 0; i < msg.recipients.length; i++){
if (i >= msg.more_recipients_value){
// append names
more_recipients += msg.recipients[i][1];
// separate them with semicolon
if (i < msg.recipients.length - 1){
more_recipients += '; ';
}
}
}
msg.more_recipients = more_recipients;
return msg;
}
});
return MailManager;
});

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

@ -0,0 +1,20 @@
/* 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);
});

46
mail_to/static/src/xml/recipient.xml

@ -1,29 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!--Copyright 2016 x620 <https://github.com/x620>
Copyright 2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
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.o_mail_info" t-operation="append">
<span class="recipients_info">
<t t-set="partner_ids" t-value="message.getCustomerEmailData()" />
<t t-if="partner_ids">
<t t-if="partner_ids.length > 0">To: </t>
<t t-foreach="partner_ids.length" t-as="i">
<t t-if="i &lt; 4">
<a
t-att-href="_.str.sprintf('/web?#id=%s&amp;view_type=form&amp;model=res.partner', partner_ids[i][0])"
class="recipient_link"
>
<i t-esc="partner_ids[i][1]" />
<t t-if="i &lt; partner_ids.length - 1">; </t>
<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>
<t t-foreach="message.partner_ids.length" t-as="i">
<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> </a>
</t> </t>
</t>
<t t-if="partner_ids.length &gt; 4">
<t t-if="message.partner_ids.length &gt; 4">
<span t-att-title="more_recipients"> <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> </span>
</t> </t>
</t> </t>
<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">
<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>
</a>
</t>
</t>
</t>
<t t-if="message.recipients.length &gt; message.more_recipients_value">
<span t-att-title="message.more_recipients">
and <t t-esc="message.recipients.length - message.more_recipients_value"/> more
</span> </span>
</t> </t>
</t></span>
</t>
</t> </t>
</template> </template>

5
mail_to/templates.xml

@ -1,4 +1,8 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!--Copyright 2016 x620 <https://github.com/x620>
Copyright 2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).-->
<openerp> <openerp>
<data> <data>
<template <template
@ -8,6 +12,7 @@
> >
<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>
</xpath> </xpath>
</template> </template>
</data> </data>

1
mail_to/tests/__init__.py

@ -1 +1,2 @@
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
from . import test_default from . import test_default

7
mail_to/tests/test_default.py

@ -1,6 +1,9 @@
from werkzeug import url_encode
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2018 Artyom Losev <https://it-projects.info/team/ArtyomLosev>
# Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
import odoo.tests import odoo.tests
from werkzeug import url_encode
@odoo.tests.common.at_install(True) @odoo.tests.common.at_install(True)

Loading…
Cancel
Save