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..9844b2e 100644 --- a/mail_to/__manifest__.py +++ b/mail_to/__manifest__.py @@ -1,13 +1,18 @@ +# 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", + "version": "12.0.1.1.0", "author": "IT-Projects LLC, Pavel Romanchenko", "support": "apps@itpp.dev", "website": "https://it-projects.info", - "license": "Other OSI approved licence", # MIT + "license": "LGPL-3", "price": 40.00, "currency": "EUR", "depends": ["mail"], 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..3707504 --- /dev/null +++ b/mail_to/models/mail_message.py @@ -0,0 +1,33 @@ +# Copyright 2019 Artem Rafailov +# Copyright 2019 Eugene Molotov +# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). +from odoo import api, models + + +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..7d7589f --- /dev/null +++ b/mail_to/static/src/js/mail_to.js @@ -0,0 +1,45 @@ +/* Copyright 2016 x620 + * Copyright 2016-2017 Ivan Yelizariev + * Copyright 2017 Artyom Losev + * Copyright 2019 Artem Rafailov + * Copyright 2019-2020 Eugene Molotov + * 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 ? 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..588b50b --- /dev/null +++ b/mail_to/static/src/js/test_mail_to.js @@ -0,0 +1,42 @@ +/* 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 steps = [ + tour.STEPS.SHOW_APPS_MENU_ITEM, + { + trigger: '.o_app[data-menu-xmlid="mail.menu_root_discuss"]', + content: _t( + "Want to get in touch with your contacts? Discuss with them here." + ), + position: "right", + edition: "community", + }, + { + trigger: '.fa.fa-plus.o_add[data-type="public"]', + position: "right", + edition: "community", + run: function(actions) { + $(".o_input.ui-autocomplete-input").val( + "Channel #" + String(new Date().getTime()) + ); + $(".o_input.ui-autocomplete-input").keydown(); + setTimeout(function() { + $(".ui-menu-item > a").click(); + }, 1000); + }, + }, + { + trigger: "a.recipient_link:first", + content: _t("Open Partners Form From Recipient Link"), + position: "bottom", + }, + ]; + + 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..cf8343e 100644 --- a/mail_to/static/src/xml/recipient.xml +++ b/mail_to/static/src/xml/recipient.xml @@ -1,26 +1,55 @@ +