Browse Source
🌈 mail_to: pre-commit auto cleanup
🌈 mail_to: pre-commit auto cleanup
Signed-off-by: Vildan Safin <safin@it-projects.info>pull/299/head
Vildan Safin
4 years ago
7 changed files with 116 additions and 77 deletions
-
3mail_to/__manifest__.py
-
23mail_to/models/mail_message.py
-
24mail_to/static/src/js/mail_to.js
-
48mail_to/static/src/js/test_mail_to.js
-
44mail_to/static/src/xml/recipient.xml
-
14mail_to/templates.xml
-
3mail_to/tests/test_default.py
@ -1,30 +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 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 |
@ -1,34 +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) { |
|||
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, { |
|||
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', |
|||
},{ |
|||
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(); |
|||
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', |
|||
}, |
|||
{ |
|||
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); |
|||
position: "bottom", |
|||
}, |
|||
]; |
|||
|
|||
tour.register("mail_to_tour", {test: true, url: "/web"}, steps); |
|||
}); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue