Browse Source

Merge remote-tracking branch 'upstream/10.0' into 11.0-mail_addons-merge2

pull/235/head
ommo73 5 years ago
parent
commit
570c37c754
No known key found for this signature in database GPG Key ID: E7E1F5C23505AFF8
  1. 3
      .travis.yml
  2. 2
      mail_base/README.rst
  3. 1
      mail_base/__init__.py
  4. 6
      mail_base/__manifest__.py
  5. 3
      mail_base/controllers/main.py
  6. 4
      mail_base/doc/changelog.rst
  7. 7
      mail_base/models.py
  8. 3
      mail_base/static/lib/base.js
  9. 1
      mail_private/__init__.py
  10. 8
      mail_private/__manifest__.py
  11. 4
      mail_private/full_composer_wizard.xml
  12. 15
      mail_private/i18n/mail_private.pot
  13. 6
      mail_private/models.py
  14. 76
      mail_private/static/src/js/mail_private.js
  15. 16
      mail_private/static/src/xml/mail_private.xml
  16. 2
      mail_private/template.xml
  17. 2
      mail_to/__init__.py
  18. 7
      mail_to/__manifest__.py
  19. 8
      mail_to/doc/changelog.rst
  20. 19
      mail_to/i18n/mail_to.pot
  21. 2
      mail_to/models/__init__.py
  22. 18
      mail_to/models/mail_message.py
  23. 21
      mail_to/static/src/js/mail_to.js
  24. 20
      mail_to/static/src/js/test_mail_to.js
  25. 23
      mail_to/static/src/xml/recipient.xml
  26. 5
      mail_to/templates.xml
  27. 1
      mail_to/tests/__init__.py
  28. 24
      mail_to/tests/test_default.py

3
.travis.yml

@ -22,7 +22,8 @@ env:
matrix: matrix:
- LINT_CHECK="1" - LINT_CHECK="1"
- CHECK_TAGS="1" - CHECK_TAGS="1"
- TESTS="1" ODOO_REPO="odoo/odoo" MAKEPOT="1"
- TESTS="1" ODOO_REPO="odoo/odoo"
- MAKEPOT="1"
- TESTS="1" ODOO_REPO="OCA/OCB" - TESTS="1" ODOO_REPO="OCA/OCB"
install: install:

2
mail_base/README.rst

@ -7,7 +7,7 @@
* fixes toggling left bar * fixes toggling left bar
* fixes Recipients field. Out-of-box this field could be empty. * fixes Recipients field. Out-of-box this field could be empty.
One can say, that the module do this todo from `addons/mail/static/src/js/chat_manager.js <https://github.com/odoo/odoo/blob/9.0/addons/mail/static/src/js/chat_manager.js#L57>`__
One can say, that the module do this todo from `addons/mail/static/src/js/chat_manager.js <https://github.com/odoo/odoo/blob/10.0/addons/mail/static/src/js/chat_manager.js#L57>`__
// to do: move this to mail.utils // to do: move this to mail.utils

1
mail_base/__init__.py

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

6
mail_base/__manifest__.py

@ -1,9 +1,13 @@
# Copyright 2016 x620 <https://github.com/x620>
# Copyright 2018 Ruslan Ronzhin <https://it-projects.info/team/rusllan/>
# Copyright 2016-2019 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html)
{ {
"name": "Mail Base", "name": "Mail Base",
"summary": """Makes Mail extendable""", "summary": """Makes Mail extendable""",
"category": "Discuss", "category": "Discuss",
"images": [], "images": [],
"version": "11.0.1.0.5",
"version": "11.0.1.1.0",
"author": "IT-Projects LLC, Pavel Romanchenko", "author": "IT-Projects LLC, Pavel Romanchenko",
"support": "apps@it-projects.info", "support": "apps@it-projects.info",

3
mail_base/controllers/main.py

@ -1,3 +1,6 @@
# Copyright 2017 mikaelh <https://github.com/mikaelh>
# Copyright 2017-2019 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html)
from openerp.http import request from openerp.http import request
from openerp.addons.bus.controllers.main import BusController from openerp.addons.bus.controllers.main import BusController

4
mail_base/doc/changelog.rst

@ -1,3 +1,7 @@
`1.1.0`
-------
- **New**: added ability to select channels for private message sending.
`1.0.5` `1.0.5`
------- -------
**FIX**: polling errors on heavy server load **FIX**: polling errors on heavy server load

7
mail_base/models.py

@ -1,3 +1,6 @@
# Copyright 2016 x620 <https://github.com/x620>
# Copyright 2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html)
from openerp import api, models from openerp import api, models
@ -12,8 +15,8 @@ class MailMessage(models.Model):
values['partner_ids'] = [] values['partner_ids'] = []
for triplet in values.get('needaction_partner_ids'): for triplet in values.get('needaction_partner_ids'):
if triplet[0] == 6: if triplet[0] == 6:
for id in triplet[2]:
values['partner_ids'].append((4, id, False))
for i in triplet[2]:
values['partner_ids'].append((4, i, False))
return super(MailMessage, self).write(values) return super(MailMessage, self).write(values)

3
mail_base/static/lib/base.js

@ -1,3 +1,6 @@
/* Copyright 2017 Artyom Losev <https://github.com/ArtyomLosev>
Copyright 2019 Artem Rafailov <https://github.com/Ommo73>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). */
odoo.define('mail_base.base', function (require) { odoo.define('mail_base.base', function (require) {
"use strict"; "use strict";

1
mail_private/__init__.py

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

8
mail_private/__manifest__.py

@ -1,3 +1,11 @@
# Copyright 2016 x620 <https://github.com/x620>
# Copyright 2016 Ilmir Karamov <https://it-projects.info/team/ilmir-k>
# Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2017 Artyom Losev <https://github.com/ArtyomLosev>
# Copyright 2018 Ruslan Ronzhin <https://it-projects.info/team/rusllan/>
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
{ {
"name": """Internal Messaging""", "name": """Internal Messaging""",
"summary": """Send private messages to specified recipients, regardless of who are in followers list.""", "summary": """Send private messages to specified recipients, regardless of who are in followers list.""",

4
mail_private/full_composer_wizard.xml

@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--Copyright 2017 Artyom Losev <https://github.com/ArtyomLosev>
Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).-->
<odoo> <odoo>
<record model="ir.ui.view" id="email_compose_message_wizard_form_private"> <record model="ir.ui.view" id="email_compose_message_wizard_form_private">

15
mail_private/i18n/mail_private.pot

@ -34,6 +34,11 @@ msgstr ""
msgid "Dummy action" msgid "Dummy action"
msgstr "" msgstr ""
#. module: mail_private
#: model:ir.model,name:mail_private.model_mail_thread
msgid "Email Thread"
msgstr ""
#. module: mail_private #. module: mail_private
#: model:ir.model,name:mail_private.model_mail_compose_message #: model:ir.model,name:mail_private.model_mail_compose_message
msgid "Email composition wizard" msgid "Email composition wizard"
@ -60,7 +65,7 @@ msgstr ""
#. module: mail_private #. module: mail_private
#. openerp-web #. openerp-web
#: code:addons/mail_private/static/src/xml/mail_private.xml:6
#: code:addons/mail_private/static/src/xml/mail_private.xml:12
#, python-format #, python-format
msgid "Send a message to specified recipients only" msgid "Send a message to specified recipients only"
msgstr "" msgstr ""
@ -75,21 +80,21 @@ msgstr ""
#. module: mail_private #. module: mail_private
#. openerp-web #. openerp-web
#: code:addons/mail_private/static/src/xml/mail_private.xml:6
#: code:addons/mail_private/static/src/xml/mail_private.xml:12
#, python-format #, python-format
msgid "Send internal message" msgid "Send internal message"
msgstr "" msgstr ""
#. module: mail_private #. module: mail_private
#. openerp-web #. openerp-web
#: code:addons/mail_private/static/src/xml/mail_private.xml:12
#: code:addons/mail_private/static/src/xml/mail_private.xml:18
#, python-format #, python-format
msgid "To: Followers of" msgid "To: Followers of"
msgstr "" msgstr ""
#. module: mail_private #. module: mail_private
#. openerp-web #. openerp-web
#: code:addons/mail_private/static/src/xml/mail_private.xml:23
#: code:addons/mail_private/static/src/xml/mail_private.xml:39
#, python-format #, python-format
msgid "Uncheck all" msgid "Uncheck all"
msgstr "" msgstr ""
@ -110,7 +115,7 @@ msgstr ""
#. module: mail_private #. module: mail_private
#. openerp-web #. openerp-web
#: code:addons/mail_private/static/src/xml/mail_private.xml:17
#: code:addons/mail_private/static/src/xml/mail_private.xml:23
#, python-format #, python-format
msgid "this document" msgid "this document"
msgstr "" msgstr ""

6
mail_private/models.py

@ -1,3 +1,9 @@
# Copyright 2016 x620 <https://github.com/x620>
# Copyright 2016 manawi <https://github.com/manawi>
# Copyright 2017 Artyom Losev <https://github.com/ArtyomLosev>
# 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, fields, api from odoo import models, fields, api

76
mail_private/static/src/js/mail_private.js

@ -1,8 +1,9 @@
/* Copyright 2016-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
Copyright 2016 manavi <https://github.com/manawi>
Copyright 2017-2018 Artyom Losev <https://github.com/ArtyomLosev>
Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */
/* Copyright 2016 x620 <https://github.com/x620>
Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
Copyright 2016 manawi <https://github.com/manawi>
Copyright 2017 Artyom Losev <https://github.com/ArtyomLosev>
Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). */
odoo.define('mail_private', function (require) { odoo.define('mail_private', function (require) {
'use strict'; 'use strict';
@ -98,7 +99,61 @@ Chatter.include({
return obj.partner_id !== session.partner_id; return obj.partner_id !== session.partner_id;
}); });
}); });
},
get_channels_for_internal_message: function () {
var self = this;
self.result = {};
return new Model(this.context.default_model).query(
['message_follower_ids', 'partner_id']).filter(
[['id', '=', self.context.default_res_id]]).all()
.then(function (thread) {
var follower_ids = thread[0].message_follower_ids;
self.result[self.context.default_res_id] = [];
self.customer = thread[0].partner_id;
// Fetch channels ids
return new Model('mail.followers').call(
'read', [follower_ids, ['channel_id']]).then(function (res_channels) {
// Filter result and push to array
var res_channels_filtered = _.map(res_channels, function (channel) {
if (channel.channel_id[0]) {
return channel.channel_id[0];
} }
}).filter(function (channel) {
return typeof channel !== 'undefined';
});
return new Model('mail.channel').call(
'read', [res_channels_filtered, ['name', 'id']]
).then(function (recipients) {
return recipients;
});
});
});
},
get_internal_users_ids: function () {
var ResUser = new Model('mail.compose.message');
this.users_ids = ResUser.call('get_internal_users_ids', [[]]).then( function (users_ids) {
return users_ids;
});
return this.users_ids;
},
get_checked_channels_ids: function () {
var self = this;
var checked_channels = [];
this.$('.o_composer_suggested_channels input:checked').each(function() {
var full_name = $(this).data('fullname').toString();
_.each(self.channels_for_internal_message, function(item) {
if (full_name === item.name) {
checked_channels.push(item.id);
}
});
});
return checked_channels;
},
}); });
ChatterComposer.include({ ChatterComposer.include({
@ -154,6 +209,17 @@ ChatterComposer.include({
this.$('.o_composer_suggested_partners input:checked').each(function() { this.$('.o_composer_suggested_partners input:checked').each(function() {
$(this).prop('checked', false); $(this).prop('checked', false);
}); });
this.$('.o_composer_suggested_channels input:checked').each(function() {
$(this).prop('checked', false);
});
},
preprocess_message: function () {
var self = this;
if (self.options.is_private) {
self.context.is_private = true;
}
return this._super();
}, },
on_open_full_composer: function() { on_open_full_composer: function() {

16
mail_private/static/src/xml/mail_private.xml

@ -1,4 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!--Copyright 2016 x620 <https://github.com/x620>
Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
Copyright 2016 manawi <https://github.com/manawi>
Copyright 2017 Artyom Losev <https://github.com/ArtyomLosev>
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.Chatter.Buttons"> <t t-extend="mail.Chatter.Buttons">
@ -20,6 +26,16 @@
</small> </small>
</t> </t>
<t t-jquery="div[class='o_composer_suggested_partners']" t-operation="after"> <t t-jquery="div[class='o_composer_suggested_partners']" t-operation="after">
<div class="o_composer_suggested_channels">
<t t-foreach='widget.suggested_channels' t-as='channel'>
<div t-attf-title="Add as channel and follower">
<input type="checkbox"
t-att-checked="channel.checked ? 'checked' : undefined"
t-att-data-fullname="channel.full_name"/>
<t t-esc="channel.name"/>
</div>
</t>
</div>
<button class="btn btn-sm btn-link oe_composer_uncheck" t-if="widget.options.is_private">Uncheck all</button> <button class="btn btn-sm btn-link oe_composer_uncheck" t-if="widget.options.is_private">Uncheck all</button>
</t> </t>
</t> </t>

2
mail_private/template.xml

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--Copyright 2016 x620 <https://github.com/x620>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).-->
<odoo> <odoo>
<template <template
id="assets_backend" id="assets_backend"

2
mail_to/__init__.py

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

7
mail_to/__manifest__.py

@ -1,9 +1,14 @@
# 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'], "images": ['images/1.png'],
"version": "11.0.1.0.1",
"version": "11.0.1.1.0",
"author": "IT-Projects LLC, Pavel Romanchenko", "author": "IT-Projects LLC, Pavel Romanchenko",
"support": "apps@it-projects.info", "support": "apps@it-projects.info",

8
mail_to/doc/changelog.rst

@ -1,7 +1,13 @@
`1.1.0`
-------
- **New**: channels are displayed in recipients
`1.0.1` `1.0.1`
------- -------
- **FIX:** The problem with duplicating the names of recipients was solved.
- **FIX**: the problem with duplicating the names of recipients was solved.
`1.0.0` `1.0.0`
------- -------

19
mail_to/i18n/mail_to.pot

@ -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:6
#: 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:15
#: 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:16
#: code:addons/mail_to/static/src/xml/recipient.xml:33
#, python-format #, python-format
msgid "more" msgid "more"
msgstr "" msgstr ""

2
mail_to/models/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import mail_message

18
mail_to/models/mail_message.py

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# 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'
@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

21
mail_to/static/src/js/mail_to.js

@ -1,3 +1,8 @@
/* 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) { odoo.define('mail_to.MailTo', function (require) {
"use strict"; "use strict";
@ -7,22 +12,30 @@ var make_message_super = chat_manager.make_message;
chat_manager.make_message = function (data) { chat_manager.make_message = function (data) {
var msg = make_message_super.call(this, data); var msg = make_message_super.call(this, data);
msg.partner_ids = data.partner_ids; msg.partner_ids = data.partner_ids;
if (!msg.partner_ids) {
msg.channel_names = data.channel_names;
msg.recipients = data.partner_ids.concat(data.channel_names);
if (!msg.partner_ids && !msg.channel_names) {
return msg; return msg;
} }
var more_recipients = ''; var more_recipients = '';
// value which define more recipients // value which define more recipients
msg.more_recipients_value = 4; msg.more_recipients_value = 4;
for (var i = 0; i < msg.partner_ids.length; i++) {
for (var i = 0; i < msg.recipients.length; i++){
if (i >= msg.more_recipients_value){ if (i >= msg.more_recipients_value){
// append names // append names
more_recipients += msg.partner_ids[i][1];
more_recipients += msg.recipients[i][1];
// separate them with semicolon // separate them with semicolon
if (i < msg.partner_ids.length - 1){
if (i < msg.recipients.length - 1){
more_recipients += '; '; more_recipients += '; ';
} }
} }
} }
msg.more_recipients = more_recipients;
return msg;
}
}
msg.more_recipients = more_recipients; msg.more_recipients = more_recipients;
return msg; return msg;
}; };

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);
});

23
mail_to/static/src/xml/recipient.xml

@ -1,19 +1,36 @@
<?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.ChatThread.Message"> <t t-extend="mail.ChatThread.Message">
<t t-jquery="p[class=o_mail_info] span:last" t-operation="after"> <t t-jquery="p[class=o_mail_info] span:last" t-operation="after">
<span class="recipients_info"><t t-if="message.partner_ids"> <span class="recipients_info"><t t-if="message.partner_ids">
<t t-if="message.partner_ids.length > 0">To: </t> <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-foreach="message.partner_ids.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"> <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>
<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 t-if="message.partner_ids.length &gt; message.more_recipients_value">
<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"> <span t-att-title="message.more_recipients">
and <t t-esc="message.partner_ids.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>

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 id="mail_to_assets_backend" <template id="mail_to_assets_backend"
@ -7,6 +11,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> <script src="/mail_to/static/src/js/mail_to.js" type="text/javascript"></script>
<script src="/mail_to/static/src/js/test_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

24
mail_to/tests/test_default.py

@ -1,18 +1,20 @@
# Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
import odoo.tests import odoo.tests
from odoo.api import Environment
@odoo.tests.common.at_install(False)
@odoo.tests.common.at_install(True)
@odoo.tests.common.post_install(True) @odoo.tests.common.post_install(True)
class TestUi(odoo.tests.HttpCase): class TestUi(odoo.tests.HttpCase):
def test_01_mail_to(self): def test_01_mail_to(self):
# checks the presence of an element with a link to the recipient
# TODO: instead of timeout, try to put $('a.recipient_link') as ready argument of phantom_js (third parameter)
code = """
setTimeout(function () {
$('a.recipient_link')[0].click();
console.log('ok');
}, 1000);
"""
link = '/web#action=%s' % self.ref('mail.mail_channel_action_client_chat')
self.phantom_js(link, code, "odoo.__DEBUG__.services['mail_to.MailTo']", login="admin")
cr = self.registry.cursor()
env = Environment(cr, self.uid, {})
env['ir.module.module'].search([('name', '=', 'mail_to')], limit=1).state = 'installed'
cr.release()
self.phantom_js("/web",
"odoo.__DEBUG__.services['web_tour.tour'].run('mail_to_tour', 1000)",
"odoo.__DEBUG__.services['web_tour.tour'].tours.mail_to_tour.ready",
login="admin", timeout=200)
Loading…
Cancel
Save