diff --git a/mail_to/__manifest__.py b/mail_to/__manifest__.py index 6d7aa35..9844b2e 100644 --- a/mail_to/__manifest__.py +++ b/mail_to/__manifest__.py @@ -7,9 +7,8 @@ "name": """Show message recipients""", "summary": """Allows you be sure, that all discussion participants were notified""", "category": "Discuss", - "images": ['images/1.png'], + "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/models/mail_message.py b/mail_to/models/mail_message.py index ff4cd85..3707504 100644 --- a/mail_to/models/mail_message.py +++ b/mail_to/models/mail_message.py @@ -1,30 +1,33 @@ # Copyright 2019 Artem Rafailov # Copyright 2019 Eugene Molotov # License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). -from odoo import models, api +from odoo import api, models class MailMessage(models.Model): - _inherit = 'mail.message' + _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 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)) + 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]) + 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 index 8336088..7d7589f 100644 --- a/mail_to/static/src/js/mail_to.js +++ b/mail_to/static/src/js/mail_to.js @@ -4,7 +4,7 @@ * 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) { +odoo.define("mail_to.MailTo", function(require) { "use strict"; var MailManager = require("mail.Manager"); @@ -15,28 +15,30 @@ odoo.define('mail_to.MailTo', function (require) { 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 : []); + 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 + 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 += '; '; - } + 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 index 2a72ccd..588b50b 100644 --- a/mail_to/static/src/js/test_mail_to.js +++ b/mail_to/static/src/js/test_mail_to.js @@ -1,34 +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) { +odoo.define("mail_to.tour", function(require) { "use strict"; var tour = require("web_tour.tour"); - var core = require('web.core'); + 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); + 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: 'a.recipient_link:first', - content: _t("Open Partners Form From Recipient Link"), - position: 'bottom', - }]; - - tour.register('mail_to_tour', { test: true, url: '/web' }, steps); + { + 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 19acdbb..cf8343e 100644 --- a/mail_to/static/src/xml/recipient.xml +++ b/mail_to/static/src/xml/recipient.xml @@ -1,4 +1,4 @@ - +