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
-
18mail_to/static/src/js/mail_to.js
-
44mail_to/static/src/js/test_mail_to.js
-
42mail_to/static/src/xml/recipient.xml
-
10mail_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 Artem Rafailov <https://it-projects.info/team/Ommo73/> |
||||
# Copyright 2019 Eugene Molotov <https://it-projects.info/team/em230418> |
# Copyright 2019 Eugene Molotov <https://it-projects.info/team/em230418> |
||||
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). |
# 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): |
class MailMessage(models.Model): |
||||
_inherit = 'mail.message' |
|
||||
|
_inherit = "mail.message" |
||||
|
|
||||
# взято с mail_base |
# взято с mail_base |
||||
@api.multi |
@api.multi |
||||
def write(self, values): |
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: |
if triplet[0] == 6: |
||||
for i in triplet[2]: |
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) |
return super(MailMessage, self).write(values) |
||||
|
|
||||
@api.multi |
@api.multi |
||||
def message_format(self): |
def message_format(self): |
||||
messages_values = super(MailMessage, self).message_format() |
messages_values = super(MailMessage, self).message_format() |
||||
for i in messages_values: |
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 |
return messages_values |
@ -1,34 +1,42 @@ |
|||||
/* Copyright 2018 Artem Rafailov <https://it-projects.info/team/KolushovAlexandr> |
/* Copyright 2018 Artem Rafailov <https://it-projects.info/team/KolushovAlexandr> |
||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).*/
|
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"; |
"use strict"; |
||||
|
|
||||
var tour = require("web_tour.tour"); |
var tour = require("web_tour.tour"); |
||||
var core = require('web.core'); |
|
||||
|
var core = require("web.core"); |
||||
var _t = core._t; |
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"]', |
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"]', |
trigger: '.fa.fa-plus.o_add[data-type="public"]', |
||||
position: 'right', |
|
||||
edition: 'community', |
|
||||
|
position: "right", |
||||
|
edition: "community", |
||||
run: function(actions) { |
run: function(actions) { |
||||
$('.o_input.ui-autocomplete-input').val("Channel #" + String(new Date().getTime())); |
|
||||
$('.o_input.ui-autocomplete-input').keydown(); |
|
||||
|
$(".o_input.ui-autocomplete-input").val( |
||||
|
"Channel #" + String(new Date().getTime()) |
||||
|
); |
||||
|
$(".o_input.ui-autocomplete-input").keydown(); |
||||
setTimeout(function() { |
setTimeout(function() { |
||||
$('.ui-menu-item > a').click(); |
|
||||
|
$(".ui-menu-item > a").click(); |
||||
}, 1000); |
}, 1000); |
||||
}, |
}, |
||||
},{ |
|
||||
trigger: 'a.recipient_link:first', |
|
||||
|
}, |
||||
|
{ |
||||
|
trigger: "a.recipient_link:first", |
||||
content: _t("Open Partners Form From Recipient Link"), |
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