diff --git a/mail_to/__init__.py b/mail_to/__init__.py index e69de29..2bb4063 100644 --- a/mail_to/__init__.py +++ b/mail_to/__init__.py @@ -0,0 +1,2 @@ +# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). +from . import models diff --git a/mail_to/__manifest__.py b/mail_to/__manifest__.py index c7b332e..4e9e942 100644 --- a/mail_to/__manifest__.py +++ b/mail_to/__manifest__.py @@ -1,9 +1,15 @@ +# Copyright 2016 x620 +# Copyright 2016 Ivan Yelizariev +# Copyright 2018 Ruslan Ronzhin +# Copyright 2019 Artem Rafailov +# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). { "name": """Show message recipients""", "summary": """Allows you be sure, that all discussion participants were notified""", "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", "support": "apps@itpp.dev", "website": "https://it-projects.info", diff --git a/mail_to/doc/changelog.rst b/mail_to/doc/changelog.rst index ea27aff..3e341ea 100644 --- a/mail_to/doc/changelog.rst +++ b/mail_to/doc/changelog.rst @@ -1,3 +1,9 @@ +`1.1.0` +------- + +- **New**: Channels are displayed in recipients + + `1.0.1` ------- diff --git a/mail_to/i18n/de.po b/mail_to/i18n/de.po index 88a1cc8..967bc16 100644 --- a/mail_to/i18n/de.po +++ b/mail_to/i18n/de.po @@ -5,7 +5,7 @@ # Translators: # Dawid Runowski , 2019 # Ermin Trevisan , 2019 -# +# msgid "" msgstr "" "Project-Id-Version: Odoo Server 11.0\n" @@ -13,7 +13,8 @@ msgstr "" "POT-Creation-Date: 2018-05-05 23:09+0000\n" "PO-Revision-Date: 2018-04-21 00:05+0000\n" "Last-Translator: Ermin Trevisan , 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" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/mail_to/i18n/mail_to.pot b/mail_to/i18n/mail_to.pot index 795c369..277895a 100644 --- a/mail_to/i18n/mail_to.pot +++ b/mail_to/i18n/mail_to.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 11.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: <>\n" "Language-Team: \n" @@ -13,23 +13,36 @@ msgstr "" "Content-Transfer-Encoding: \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 #. openerp-web #: code:addons/mail_to/static/src/xml/recipient.xml:10 +#: code:addons/mail_to/static/src/xml/recipient.xml:11 #, python-format msgid "To:" msgstr "" #. module: mail_to #. openerp-web -#: code:addons/mail_to/static/src/xml/recipient.xml:24 +#: code:addons/mail_to/static/src/xml/recipient.xml:32 #, python-format msgid "and" msgstr "" #. module: mail_to #. openerp-web -#: code:addons/mail_to/static/src/xml/recipient.xml:25 +#: code:addons/mail_to/static/src/xml/recipient.xml:33 #, python-format msgid "more" msgstr "" diff --git a/mail_to/i18n/sl.po b/mail_to/i18n/sl.po index 30218b8..3c3d6b0 100644 --- a/mail_to/i18n/sl.po +++ b/mail_to/i18n/sl.po @@ -1,10 +1,10 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * mail_to -# +# # Translators: # Matjaz Mozetic , 2019 -# +# msgid "" msgstr "" "Project-Id-Version: Odoo Server 11.0\n" @@ -12,12 +12,14 @@ msgstr "" "POT-Creation-Date: 2018-05-05 23:09+0000\n" "PO-Revision-Date: 2018-04-21 00:05+0000\n" "Last-Translator: Matjaz Mozetic , 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" "Content-Type: text/plain; charset=UTF-8\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 #. openerp-web diff --git a/mail_to/models/__init__.py b/mail_to/models/__init__.py new file mode 100644 index 0000000..a2bc21b --- /dev/null +++ b/mail_to/models/__init__.py @@ -0,0 +1 @@ +from . import mail_message diff --git a/mail_to/models/mail_message.py b/mail_to/models/mail_message.py new file mode 100644 index 0000000..f7a75f4 --- /dev/null +++ b/mail_to/models/mail_message.py @@ -0,0 +1,29 @@ +# Copyright 2019 Artem Rafailov +# 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 diff --git a/mail_to/static/src/js/mail_to.js b/mail_to/static/src/js/mail_to.js new file mode 100644 index 0000000..88031d5 --- /dev/null +++ b/mail_to/static/src/js/mail_to.js @@ -0,0 +1,42 @@ +/* Copyright 2016 x620 + * Copyright 2016-2017 Ivan Yelizariev + * Copyright 2017 Artyom Losev + * Copyright 2019 Artem Rafailov + * 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; +}); diff --git a/mail_to/static/src/js/test_mail_to.js b/mail_to/static/src/js/test_mail_to.js new file mode 100644 index 0000000..ff20b9d --- /dev/null +++ b/mail_to/static/src/js/test_mail_to.js @@ -0,0 +1,20 @@ +/* Copyright 2018 Artem Rafailov + 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); + +}); diff --git a/mail_to/static/src/xml/recipient.xml b/mail_to/static/src/xml/recipient.xml index e6d843b..5838bdb 100644 --- a/mail_to/static/src/xml/recipient.xml +++ b/mail_to/static/src/xml/recipient.xml @@ -1,29 +1,43 @@ - + + diff --git a/mail_to/templates.xml b/mail_to/templates.xml index 846c8c8..c847cea 100644 --- a/mail_to/templates.xml +++ b/mail_to/templates.xml @@ -1,4 +1,8 @@ - + + diff --git a/mail_to/tests/__init__.py b/mail_to/tests/__init__.py index 7ea835c..d8b94c0 100644 --- a/mail_to/tests/__init__.py +++ b/mail_to/tests/__init__.py @@ -1 +1,2 @@ +# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). from . import test_default diff --git a/mail_to/tests/test_default.py b/mail_to/tests/test_default.py index c8a4f74..d0bf499 100644 --- a/mail_to/tests/test_default.py +++ b/mail_to/tests/test_default.py @@ -1,6 +1,9 @@ -from werkzeug import url_encode - +# Copyright 2018 Ivan Yelizariev +# Copyright 2018 Artyom Losev +# Copyright 2019 Kolushov Alexandr +# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). import odoo.tests +from werkzeug import url_encode @odoo.tests.common.at_install(True)