Browse Source
Merge pull request #299 from Enigma228322/12.0-mail_to
Merge pull request #299 from Enigma228322/12.0-mail_to
commit is created by 👷♂️ Merge Bot: https://odoo-devops.readthedocs.io/en/latest/git/github-merge-bot.htmlpull/301/head
Mitchell Admin
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 223 additions and 32 deletions
-
2mail_to/__init__.py
-
9mail_to/__manifest__.py
-
6mail_to/doc/changelog.rst
-
3mail_to/i18n/de.po
-
19mail_to/i18n/mail_to.pot
-
8mail_to/i18n/sl.po
-
1mail_to/models/__init__.py
-
33mail_to/models/mail_message.py
-
45mail_to/static/src/js/mail_to.js
-
42mail_to/static/src/js/test_mail_to.js
-
53mail_to/static/src/xml/recipient.xml
-
12mail_to/templates.xml
-
1mail_to/tests/__init__.py
-
13mail_to/tests/test_default.py
@ -0,0 +1,2 @@ |
|||
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). |
|||
from . import models |
@ -0,0 +1 @@ |
|||
from . import mail_message |
@ -0,0 +1,33 @@ |
|||
# Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/> |
|||
# Copyright 2019 Eugene Molotov <https://it-projects.info/team/em230418> |
|||
# 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 |
@ -0,0 +1,45 @@ |
|||
/* 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/>
|
|||
* Copyright 2019-2020 Eugene Molotov <https://it-projects.info/team/em230418>
|
|||
* 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; |
|||
}); |
@ -0,0 +1,42 @@ |
|||
/* 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 steps = [ |
|||
tour.STEPS.SHOW_APPS_MENU_ITEM, |
|||
{ |
|||
trigger: '.o_app[data-menu-xmlid="mail.menu_root_discuss"]', |
|||
content: _t( |
|||
"Want to <b>get in touch</b> with your contacts? <i>Discuss with them here.</i>" |
|||
), |
|||
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); |
|||
}); |
@ -1 +1,2 @@ |
|||
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). |
|||
from . import test_default |
Write
Preview
Loading…
Cancel
Save
Reference in new issue