From 002dcbca0b2871796033d8d4944d9999298200ee Mon Sep 17 00:00:00 2001 From: ommo73 Date: Sat, 26 Oct 2019 17:15:39 +0500 Subject: [PATCH] :ambulance: mail_to: fixing errors --- mail_to/__init__.py | 2 +- mail_to/doc/changelog.rst | 3 +- mail_to/i18n/de.po | 7 +-- mail_to/i18n/mail_to.pot | 66 --------------------------- mail_to/i18n/sl.po | 12 ++--- mail_to/models/mail_message.py | 11 +++++ mail_to/static/src/js/mail_to.js | 23 ++++++---- mail_to/static/src/js/test_mail_to.js | 20 -------- mail_to/static/src/xml/recipient.xml | 51 ++++++++++----------- mail_to/templates.xml | 3 +- mail_to/tests/test_default.py | 4 -- 11 files changed, 58 insertions(+), 144 deletions(-) delete mode 100644 mail_to/i18n/mail_to.pot delete mode 100644 mail_to/static/src/js/test_mail_to.js diff --git a/mail_to/__init__.py b/mail_to/__init__.py index 2bb40636..5f636fd1 100644 --- a/mail_to/__init__.py +++ b/mail_to/__init__.py @@ -1,2 +1,2 @@ # License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). -from . import models +from . import models \ No newline at end of file diff --git a/mail_to/doc/changelog.rst b/mail_to/doc/changelog.rst index 3e341ea9..f96739c2 100644 --- a/mail_to/doc/changelog.rst +++ b/mail_to/doc/changelog.rst @@ -1,8 +1,7 @@ `1.1.0` ------- -- **New**: Channels are displayed in recipients - +- **New**: channels are displayed in recipients `1.0.1` ------- diff --git a/mail_to/i18n/de.po b/mail_to/i18n/de.po index c15403f4..88a1cc83 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,12 +13,7 @@ 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" -<<<<<<< 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" ->>>>>>> upstream/11.0 "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 deleted file mode 100644 index 153ed4c9..00000000 --- a/mail_to/i18n/mail_to.pot +++ /dev/null @@ -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 "" - diff --git a/mail_to/i18n/sl.po b/mail_to/i18n/sl.po index 3c3d6b0a..30218b80 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,14 +12,12 @@ 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: sl\n" +"Language-Team: Slovenian (https://www.transifex.com/it-projects-llc/teams/76080/sl/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\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 #. openerp-web diff --git a/mail_to/models/mail_message.py b/mail_to/models/mail_message.py index c827072f..507c2191 100644 --- a/mail_to/models/mail_message.py +++ b/mail_to/models/mail_message.py @@ -13,5 +13,16 @@ def message_format(self): if i['channel_ids']: i['channel_names'] = self.env['mail.channel'].browse(i['channel_ids']).mapped( 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 diff --git a/mail_to/static/src/js/mail_to.js b/mail_to/static/src/js/mail_to.js index 665ee256..d9debd86 100644 --- a/mail_to/static/src/js/mail_to.js +++ b/mail_to/static/src/js/mail_to.js @@ -6,15 +6,16 @@ odoo.define('mail_to.MailTo', function (require) { "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.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; } @@ -27,14 +28,16 @@ chat_manager.make_message = function (data) { more_recipients += msg.recipients[i][1]; // separate them with semicolon if (i < msg.recipients.length - 1){ - more_recipients += '; '; + more_recipients += ', '; } } } msg.more_recipients = more_recipients; + return msg; - }; + } + }); - return chat_manager; + return MailManager; }); diff --git a/mail_to/static/src/js/test_mail_to.js b/mail_to/static/src/js/test_mail_to.js deleted file mode 100644 index ff20b9d3..00000000 --- a/mail_to/static/src/js/test_mail_to.js +++ /dev/null @@ -1,20 +0,0 @@ -/* 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 312240a5..74cf2afe 100644 --- a/mail_to/static/src/xml/recipient.xml +++ b/mail_to/static/src/xml/recipient.xml @@ -5,40 +5,37 @@ License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).--> diff --git a/mail_to/templates.xml b/mail_to/templates.xml index 7f14be35..b61eebde 100644 --- a/mail_to/templates.xml +++ b/mail_to/templates.xml @@ -10,7 +10,8 @@ inherit_id="web.assets_backend"> - +