Browse Source
Merge pull request #259 from yelizariev/11.0-pre-commit-cleanups
Merge pull request #259 from yelizariev/11.0-pre-commit-cleanups
commit is created by 👷♂️ Merge Bot: https://odoo-devops.readthedocs.io/en/latest/git/github-merge-bot.htmlpull/263/head
Mitchell Admin
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
108 changed files with 2186 additions and 1629 deletions
-
6.DINAR/image/README.md
-
1.DINAR/image/src/addons.yaml
-
2.isort.cfg
-
21.travis.yml
-
24mail_all/__manifest__.py
-
93mail_all/static/src/js/mail_all.js
-
11mail_all/static/src/xml/menu.xml
-
1mail_all/tests/__init__.py
-
7mail_all/tests/test_js.py
-
17mail_all/views/templates.xml
-
23mail_archives/__manifest__.py
-
148mail_archives/static/src/js/archives.js
-
11mail_archives/static/src/xml/menu.xml
-
1mail_archives/tests/__init__.py
-
10mail_archives/tests/test_js.py
-
20mail_archives/views/templates.xml
-
18mail_base/__manifest__.py
-
9mail_base/controllers/main.py
-
20mail_base/models.py
-
1mail_base/tests/__init__.py
-
7mail_base/tests/test_default.py
-
12mail_base/views/templates.xml
-
26mail_check_immediately/__manifest__.py
-
51mail_check_immediately/models.py
-
53mail_check_immediately/static/src/js/main.js
-
14mail_check_immediately/static/src/xml/main.xml
-
11mail_check_immediately/views.xml
-
4mail_fix_553/__manifest__.py
-
2mail_fix_553/data.xml
-
160mail_fix_553/mail_fix_553.py
-
33mail_move_message/__manifest__.py
-
7mail_move_message/controllers/main.py
-
3mail_move_message/data/mail_move_message_data.xml
-
515mail_move_message/mail_move_message_models.py
-
135mail_move_message/mail_move_message_views.xml
-
5mail_move_message/static/src/css/mail_move_message.css
-
149mail_move_message/static/src/js/mail_move_message.js
-
11mail_move_message/static/src/xml/mail_move_message_main.xml
-
1mail_move_message/tests/__init__.py
-
13mail_move_message/tests/test_mail_move.py
-
18mail_multi_website/__init__.py
-
21mail_multi_website/__manifest__.py
-
12mail_multi_website/models/ir_property.py
-
8mail_multi_website/models/mail_message.py
-
112mail_multi_website/models/mail_template.py
-
29mail_multi_website/models/mail_thread.py
-
16mail_multi_website/models/res_users.py
-
6mail_multi_website/models/website.py
-
53mail_multi_website/tests/test_fetch.py
-
16mail_multi_website/tests/test_mail_model.py
-
116mail_multi_website/tests/test_render.py
-
49mail_multi_website/tests/test_send.py
-
6mail_multi_website/views/website_views.xml
-
12mail_multi_website/wizard/mail_compose_message.py
-
21mail_private/__manifest__.py
-
16mail_private/full_composer_wizard.xml
-
130mail_private/models.py
-
9mail_private/static/src/css/mail_private.css
-
498mail_private/static/src/js/mail_private.js
-
43mail_private/static/src/js/test_private.js
-
25mail_private/static/src/xml/mail_private.xml
-
24mail_private/template.xml
-
20mail_private/tests/test_js.py
-
22mail_recovery/__manifest__.py
-
13mail_recovery/data.xml
-
15mail_recovery/static/src/js/mail_recovery.js
-
18mail_reply/__manifest__.py
-
76mail_reply/static/src/js/mail_reply.js
-
14mail_reply/static/src/xml/reply_button.xml
-
15mail_reply/templates.xml
-
1mail_reply/tests/__init__.py
-
7mail_reply/tests/test_default.py
-
25mail_sent/__manifest__.py
-
30mail_sent/models.py
-
114mail_sent/static/src/js/sent.js
-
14mail_sent/static/src/xml/menu.xml
-
1mail_sent/tests/__init__.py
-
10mail_sent/tests/test_js.py
-
14mail_sent/views/templates.xml
-
16mail_to/__manifest__.py
-
13mail_to/models/mail_message.py
-
52mail_to/static/src/js/mail_to.js
-
18mail_to/static/src/js/test_mail_to.js
-
31mail_to/static/src/xml/recipient.xml
-
22mail_to/templates.xml
-
16mail_to/tests/test_default.py
-
23mailgun/__manifest__.py
-
16mailgun/controllers/main.py
-
6mailgun/data/ir_cron_data.xml
-
20mailgun/models/ir_config_parameter.py
-
19mailgun/models/mail_thread.py
-
22res_partner_company_messages/__manifest__.py
-
18res_partner_company_messages/models.py
-
2res_partner_company_messages/views.xml
-
16res_partner_mails_count/__manifest__.py
-
15res_partner_mails_count/models.py
-
44res_partner_mails_count/static/src/js/res_partner_mails_count_tour.js
-
35res_partner_mails_count/templates.xml
-
2res_partner_mails_count/tests/__init__.py
-
67res_partner_mails_count/tests/test_mail.py
@ -1,2 +1,4 @@ |
|||
This folder is attached on image building as `custom/` folder in [doobba](https://github.com/Tecnativa/doodba#image-usage). |
|||
Few additional [files](https://github.com/itpp-labs/DINAR/tree/master/embedded-files/.DINAR/image) are attached temporary on image building. |
|||
This folder is attached on image building as `custom/` folder in |
|||
[doobba](https://github.com/Tecnativa/doodba#image-usage). Few additional |
|||
[files](https://github.com/itpp-labs/DINAR/tree/master/embedded-files/.DINAR/image) are |
|||
attached temporary on image building. |
@ -1,57 +1,56 @@ |
|||
odoo.define('mail_all.all', function (require) { |
|||
"use strict"; |
|||
|
|||
var chat_manager = require('mail_base.base').chat_manager; |
|||
var core = require('web.core'); |
|||
|
|||
var _lt = core._lt; |
|||
|
|||
var ChatAction = core.action_registry.get('mail.chat.instant_messaging'); |
|||
ChatAction.include({ |
|||
get_thread_rendering_options: function (messages) { |
|||
var options = this._super.apply(this, arguments); |
|||
options.display_subject = options.display_subject || this.channel.id === "channel_all"; |
|||
return options; |
|||
} |
|||
}); |
|||
|
|||
// override methods
|
|||
var chat_manager_super = _.clone(chat_manager); |
|||
|
|||
chat_manager.get_properties = function (msg) { |
|||
var properties = chat_manager_super.get_properties.apply(this, arguments); |
|||
properties.is_all = this.property_descr("channel_all", msg, this); |
|||
return properties; |
|||
}; |
|||
|
|||
chat_manager.set_channel_flags = function (data, msg) { |
|||
chat_manager_super.set_channel_flags.apply(this, arguments); |
|||
msg.is_all = data.author_id !== 'ODOOBOT'; |
|||
return msg; |
|||
}; |
|||
|
|||
chat_manager.get_channel_array = function (msg) { |
|||
var arr = chat_manager_super.get_channel_array.apply(this, arguments); |
|||
return arr.concat('channel_all'); |
|||
}; |
|||
|
|||
chat_manager.get_domain = function (channel) { |
|||
return (channel.id === "channel_all") |
|||
? [] |
|||
: chat_manager_super.get_domain.apply(this, arguments); |
|||
}; |
|||
|
|||
odoo.define("mail_all.all", function(require) { |
|||
"use strict"; |
|||
|
|||
var chat_manager = require("mail_base.base").chat_manager; |
|||
var core = require("web.core"); |
|||
|
|||
var _lt = core._lt; |
|||
|
|||
var ChatAction = core.action_registry.get("mail.chat.instant_messaging"); |
|||
ChatAction.include({ |
|||
get_thread_rendering_options: function(messages) { |
|||
var options = this._super.apply(this, arguments); |
|||
options.display_subject = |
|||
options.display_subject || this.channel.id === "channel_all"; |
|||
return options; |
|||
}, |
|||
}); |
|||
|
|||
chat_manager.is_ready.then(function () { |
|||
// Override methods
|
|||
var chat_manager_super = _.clone(chat_manager); |
|||
|
|||
chat_manager.get_properties = function(msg) { |
|||
var properties = chat_manager_super.get_properties.apply(this, arguments); |
|||
properties.is_all = this.property_descr("channel_all", msg, this); |
|||
return properties; |
|||
}; |
|||
|
|||
chat_manager.set_channel_flags = function(data, msg) { |
|||
chat_manager_super.set_channel_flags.apply(this, arguments); |
|||
msg.is_all = data.author_id !== "ODOOBOT"; |
|||
return msg; |
|||
}; |
|||
|
|||
chat_manager.get_channel_array = function(msg) { |
|||
var arr = chat_manager_super.get_channel_array.apply(this, arguments); |
|||
return arr.concat("channel_all"); |
|||
}; |
|||
|
|||
chat_manager.get_domain = function(channel) { |
|||
return channel.id === "channel_all" |
|||
? [] |
|||
: chat_manager_super.get_domain.apply(this, arguments); |
|||
}; |
|||
|
|||
chat_manager.is_ready.then(function() { |
|||
// Add all channel
|
|||
chat_manager.add_channel({ |
|||
id: "channel_all", |
|||
name: _lt("All messages"), |
|||
type: "static" |
|||
type: "static", |
|||
}); |
|||
return $.when(); |
|||
}); |
|||
|
|||
return chat_manager; |
|||
|
|||
return chat_manager; |
|||
}); |
@ -1,2 +1 @@ |
|||
|
|||
from . import test_js |
@ -1,12 +1,17 @@ |
|||
<?xml version="1.0"?> |
|||
<?xml version="1.0" ?> |
|||
<openerp> |
|||
<data> |
|||
<template id="mail_all_assets_backend" |
|||
name="mail_all_assets_backend" |
|||
inherit_id="web.assets_backend"> |
|||
<template |
|||
id="mail_all_assets_backend" |
|||
name="mail_all_assets_backend" |
|||
inherit_id="web.assets_backend" |
|||
> |
|||
<xpath expr="." position="inside"> |
|||
<link rel="stylesheet" href="/mail_all/static/src/css/mail_all.css"/> |
|||
<script src="/mail_all/static/src/js/mail_all.js" type="text/javascript"></script> |
|||
<link rel="stylesheet" href="/mail_all/static/src/css/mail_all.css" /> |
|||
<script |
|||
src="/mail_all/static/src/js/mail_all.js" |
|||
type="text/javascript" |
|||
/> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
|
@ -1,76 +1,80 @@ |
|||
odoo.define('mail_archives.archives', function (require) { |
|||
"use strict"; |
|||
|
|||
var core = require('web.core'); |
|||
var session = require('web.session'); |
|||
var chat_manager = require('mail_base.base').chat_manager; |
|||
|
|||
var _lt = core._lt; |
|||
|
|||
|
|||
var ChatAction = core.action_registry.get('mail.chat.instant_messaging'); |
|||
ChatAction.include({ |
|||
init: function (parent, action, options) { |
|||
this._super.apply(this, arguments); |
|||
var channel_name = 'channel_archive'; |
|||
// Add channel Archive for enable "display_subject" option
|
|||
this.channels_display_subject.push(channel_name); |
|||
}, |
|||
|
|||
update_message_on_current_channel: function (current_channel_id, message){ |
|||
var result = this._super.apply(this, arguments); |
|||
var archive = current_channel_id === "channel_archive" && !message.is_archive; |
|||
return archive || result; |
|||
} |
|||
}); |
|||
|
|||
// Inherit class and override methods
|
|||
|
|||
var chat_manager_super = _.clone(chat_manager); |
|||
|
|||
chat_manager.get_properties = function (msg) { |
|||
var properties = chat_manager_super.get_properties.apply(this, arguments); |
|||
properties.is_archive = this.property_descr("channel_archive", msg, this); |
|||
return properties; |
|||
}; |
|||
|
|||
chat_manager.set_channel_flags = function (data, msg) { |
|||
chat_manager_super.set_channel_flags.apply(this, arguments); |
|||
// Get recipients ids
|
|||
var recipients_ids = []; |
|||
for (var i = 0; i < (data.partner_ids || []).length; i++){ |
|||
recipients_ids.push(data.partner_ids[i][0]); |
|||
} |
|||
|
|||
// If author or recipient
|
|||
if (data.author_id[0] === session.partner_id || recipients_ids.indexOf(session.partner_id) !== -1) { |
|||
msg.is_archive = true; |
|||
} |
|||
|
|||
return msg; |
|||
}; |
|||
|
|||
chat_manager.get_channel_array = function (msg) { |
|||
var arr = chat_manager_super.get_channel_array.apply(this, arguments); |
|||
return arr.concat('channel_archive'); |
|||
}; |
|||
|
|||
chat_manager.get_domain = function (channel) { |
|||
return (channel.id === "channel_archive") |
|||
? ['|', ['partner_ids', 'in', [session.partner_id]], |
|||
['author_id', 'in', [session.partner_id]]] |
|||
: chat_manager_super.get_domain.apply(this, arguments); |
|||
}; |
|||
|
|||
chat_manager.is_ready.then(function () { |
|||
chat_manager.add_channel({ |
|||
id: "channel_archive", |
|||
name: _lt("Archive"), |
|||
type: "static" |
|||
odoo.define("mail_archives.archives", function(require) { |
|||
"use strict"; |
|||
|
|||
var core = require("web.core"); |
|||
var session = require("web.session"); |
|||
var chat_manager = require("mail_base.base").chat_manager; |
|||
|
|||
var _lt = core._lt; |
|||
|
|||
var ChatAction = core.action_registry.get("mail.chat.instant_messaging"); |
|||
ChatAction.include({ |
|||
init: function(parent, action, options) { |
|||
this._super.apply(this, arguments); |
|||
var channel_name = "channel_archive"; |
|||
// Add channel Archive for enable "display_subject" option
|
|||
this.channels_display_subject.push(channel_name); |
|||
}, |
|||
|
|||
update_message_on_current_channel: function(current_channel_id, message) { |
|||
var result = this._super.apply(this, arguments); |
|||
var archive = |
|||
current_channel_id === "channel_archive" && !message.is_archive; |
|||
return archive || result; |
|||
}, |
|||
}); |
|||
}); |
|||
|
|||
// Inherit class and override methods
|
|||
|
|||
var chat_manager_super = _.clone(chat_manager); |
|||
|
|||
chat_manager.get_properties = function(msg) { |
|||
var properties = chat_manager_super.get_properties.apply(this, arguments); |
|||
properties.is_archive = this.property_descr("channel_archive", msg, this); |
|||
return properties; |
|||
}; |
|||
|
|||
chat_manager.set_channel_flags = function(data, msg) { |
|||
chat_manager_super.set_channel_flags.apply(this, arguments); |
|||
// Get recipients ids
|
|||
var recipients_ids = []; |
|||
for (var i = 0; i < (data.partner_ids || []).length; i++) { |
|||
recipients_ids.push(data.partner_ids[i][0]); |
|||
} |
|||
|
|||
// If author or recipient
|
|||
if ( |
|||
data.author_id[0] === session.partner_id || |
|||
recipients_ids.indexOf(session.partner_id) !== -1 |
|||
) { |
|||
msg.is_archive = true; |
|||
} |
|||
|
|||
return msg; |
|||
}; |
|||
|
|||
chat_manager.get_channel_array = function(msg) { |
|||
var arr = chat_manager_super.get_channel_array.apply(this, arguments); |
|||
return arr.concat("channel_archive"); |
|||
}; |
|||
|
|||
chat_manager.get_domain = function(channel) { |
|||
return channel.id === "channel_archive" |
|||
? [ |
|||
"|", |
|||
["partner_ids", "in", [session.partner_id]], |
|||
["author_id", "in", [session.partner_id]], |
|||
] |
|||
: chat_manager_super.get_domain.apply(this, arguments); |
|||
}; |
|||
|
|||
chat_manager.is_ready.then(function() { |
|||
chat_manager.add_channel({ |
|||
id: "channel_archive", |
|||
name: _lt("Archive"), |
|||
type: "static", |
|||
}); |
|||
}); |
|||
|
|||
return chat_manager; |
|||
|
|||
return chat_manager; |
|||
}); |
@ -1,2 +1 @@ |
|||
|
|||
from . import test_js |
@ -1,12 +1,20 @@ |
|||
<?xml version="1.0"?> |
|||
<?xml version="1.0" ?> |
|||
<openerp> |
|||
<data> |
|||
<template id="res_partner_mails_count_assets_backend" |
|||
name="res_partner_mails_count_assets_backend" |
|||
inherit_id="web.assets_backend"> |
|||
<template |
|||
id="res_partner_mails_count_assets_backend" |
|||
name="res_partner_mails_count_assets_backend" |
|||
inherit_id="web.assets_backend" |
|||
> |
|||
<xpath expr="." position="inside"> |
|||
<link rel="stylesheet" href="/mail_archives/static/src/css/archives.css"/> |
|||
<script src="/mail_archives/static/src/js/archives.js" type="text/javascript"></script> |
|||
<link |
|||
rel="stylesheet" |
|||
href="/mail_archives/static/src/css/archives.css" |
|||
/> |
|||
<script |
|||
src="/mail_archives/static/src/js/archives.js" |
|||
type="text/javascript" |
|||
/> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
|
@ -1,2 +1 @@ |
|||
|
|||
from . import test_default |
@ -1,11 +1,13 @@ |
|||
<?xml version="1.0"?> |
|||
<?xml version="1.0" ?> |
|||
<openerp> |
|||
<data> |
|||
<template id="mail_base_assets_backend" |
|||
name="mail_base_assets_backend" |
|||
inherit_id="web.assets_backend"> |
|||
<template |
|||
id="mail_base_assets_backend" |
|||
name="mail_base_assets_backend" |
|||
inherit_id="web.assets_backend" |
|||
> |
|||
<xpath expr="." position="inside"> |
|||
<script src="/mail_base/static/lib/base.js" type="text/javascript"></script> |
|||
<script src="/mail_base/static/lib/base.js" type="text/javascript" /> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
|
@ -1,19 +1,15 @@ |
|||
{ |
|||
'name': 'Check mail immediately', |
|||
'version': '1.0.1', |
|||
'author': 'IT-Projects LLC, Ivan Yelizariev', |
|||
'license': 'LGPL-3', |
|||
"name": "Check mail immediately", |
|||
"vesion": "11.0.1.0.1", |
|||
"author": "IT-Projects LLC, Ivan Yelizariev", |
|||
"license": "LGPL-3", |
|||
"category": "Discuss", |
|||
"support": "apps@it-projects.info", |
|||
'website': 'https://twitter.com/yelizariev', |
|||
'price': 9.00, |
|||
'currency': 'EUR', |
|||
'depends': ['base', 'web', 'fetchmail', 'mail'], |
|||
'data': [ |
|||
'views.xml', |
|||
], |
|||
'qweb': [ |
|||
"static/src/xml/main.xml", |
|||
], |
|||
'installable': False |
|||
"website": "https://twitter.com/yelizariev", |
|||
"price": 9.00, |
|||
"currency": "EUR", |
|||
"depends": ["base", "web", "fetchmail", "mail"], |
|||
"data": ["views.xml"], |
|||
"qweb": ["static/src/xml/main.xml"], |
|||
"installable": False, |
|||
} |
@ -1,8 +1,15 @@ |
|||
<openerp> |
|||
<data> |
|||
<template id="assets_backend_inherited_check_mail" name="Check mail immediately bar" inherit_id="web.assets_backend"> |
|||
<template |
|||
id="assets_backend_inherited_check_mail" |
|||
name="Check mail immediately bar" |
|||
inherit_id="web.assets_backend" |
|||
> |
|||
<xpath expr="." position="inside"> |
|||
<script type="text/javascript" src="/mail_check_immediately/static/src/js/main.js"></script> |
|||
<script |
|||
type="text/javascript" |
|||
src="/mail_check_immediately/static/src/js/main.js" |
|||
/> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
|
@ -1,15 +1,18 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!--# Copyright 2016 Ildar Nasyrov <https://it-projects.info/team/iledarn> |
|||
# Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
|||
# Copyright 2016 Pavel Romanchenko |
|||
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).--> |
|||
|
|||
<template> |
|||
<t t-extend="mail.ChatThread.Message"> |
|||
<t t-jquery='p.o_mail_info span:last-child i:first-child' t-operation="before"> |
|||
<i t-if="!message.is_system_notification" t-att-class="'fa fa-exchange oe_move' + (message.is_moved ? ' oe_moved' : '')" |
|||
t-att-data-message-id="message.id" title="Move to thread"/> |
|||
<i |
|||
t-if="!message.is_system_notification" |
|||
t-att-class="'fa fa-exchange oe_move' + (message.is_moved ? ' oe_moved' : '')" |
|||
t-att-data-message-id="message.id" |
|||
title="Move to thread" |
|||
/> |
|||
</t> |
|||
</t> |
|||
</template> |
@ -1,3 +1,2 @@ |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
|||
from . import test_mail_move |
|||
|
@ -1,19 +1,19 @@ |
|||
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
|||
from odoo import models, api |
|||
from odoo import api, models |
|||
|
|||
|
|||
class IrProperty(models.Model): |
|||
_inherit = 'ir.property' |
|||
_inherit = "ir.property" |
|||
|
|||
@api.multi |
|||
def write(self, vals): |
|||
res = super(IrProperty, self).write(vals) |
|||
field_object_list = [ |
|||
self.env.ref('base.field_res_users_email'), |
|||
self.env.ref('mail.field_mail_template_body_html'), |
|||
self.env.ref('mail.field_mail_template_mail_server_id'), |
|||
self.env.ref('mail.field_mail_template_report_template'), |
|||
self.env.ref("base.field_res_users_email"), |
|||
self.env.ref("mail.field_mail_template_body_html"), |
|||
self.env.ref("mail.field_mail_template_mail_server_id"), |
|||
self.env.ref("mail.field_mail_template_report_template"), |
|||
] |
|||
for fobj in field_object_list: |
|||
self._update_db_value_website_dependent(fobj) |
|||
|
@ -1,16 +1,16 @@ |
|||
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
|||
from odoo import models, fields |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class Message(models.Model): |
|||
_inherit = 'mail.message' |
|||
_inherit = "mail.message" |
|||
|
|||
def _default_mail_server_id(self): |
|||
website = self.env.context.get('website_id') |
|||
website = self.env.context.get("website_id") |
|||
if not website: |
|||
return |
|||
website = self.env['website'].sudo().browse(website) |
|||
website = self.env["website"].sudo().browse(website) |
|||
return website.mail_server_id.id |
|||
|
|||
mail_server_id = fields.Many2one(default=_default_mail_server_id) |
@ -1,10 +1,12 @@ |
|||
# Copyright 2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
|||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). |
|||
|
|||
from odoo import models, fields |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class Website(models.Model): |
|||
_inherit = "website" |
|||
|
|||
mail_server_id = fields.Many2one('ir.mail_server', 'Outgoing Mails', help='Default outgoing mail server') |
|||
mail_server_id = fields.Many2one( |
|||
"ir.mail_server", "Outgoing Mails", help="Default outgoing mail server" |
|||
) |
@ -1,10 +1,18 @@ |
|||
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
|||
from odoo import models, fields |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class MailTest(models.Model): |
|||
_inherit = 'mail.test' |
|||
_inherit = "mail.test" |
|||
|
|||
company_id = fields.Many2one('res.company', default=lambda self: self.env['res.company']._company_default_get()) |
|||
website_id = fields.Many2one('website', default=lambda self: self.env['website'].browse(self.env.context.get('website_id'))) |
|||
company_id = fields.Many2one( |
|||
"res.company", |
|||
default=lambda self: self.env["res.company"]._company_default_get(), |
|||
) |
|||
website_id = fields.Many2one( |
|||
"website", |
|||
default=lambda self: self.env["website"].browse( |
|||
self.env.context.get("website_id") |
|||
), |
|||
) |
@ -1,13 +1,13 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<!-- Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
|||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). --> |
|||
<odoo> |
|||
<record id="view_website_multi_mail_form" model="ir.ui.view"> |
|||
<field name="model">website</field> |
|||
<field name="inherit_id" ref="website.view_website_form"/> |
|||
<field name="inherit_id" ref="website.view_website_form" /> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='default_lang_id']" position="after"> |
|||
<field name="mail_server_id"/> |
|||
<field name="mail_server_id" /> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
@ -1,20 +1,22 @@ |
|||
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
|||
from odoo import models, api |
|||
from odoo import api, models |
|||
from odoo.http import request |
|||
|
|||
|
|||
class MailComposer(models.TransientModel): |
|||
|
|||
_inherit = 'mail.compose.message' |
|||
_inherit = "mail.compose.message" |
|||
|
|||
@api.model |
|||
def create(self, vals): |
|||
"""Workaround for https://github.com/odoo/odoo/pull/26589""" |
|||
if 'website_id' not in self.env.context: |
|||
website = request and hasattr(request, 'website') and request.website or None |
|||
if "website_id" not in self.env.context: |
|||
website = ( |
|||
request and hasattr(request, "website") and request.website or None |
|||
) |
|||
if not website: |
|||
website = self.env['website'].get_current_website() |
|||
website = self.env["website"].get_current_website() |
|||
if website: |
|||
self = self.with_context(website_id=website.id) |
|||
return super(MailComposer, self).create(vals) |
@ -1,10 +1,9 @@ |
|||
.o_composer_suggested_channels{ |
|||
.o_composer_suggested_channels { |
|||
margin-top: -5px; |
|||
} |
|||
|
|||
.oe_composer_uncheck{ |
|||
.oe_composer_uncheck { |
|||
float: bottom; |
|||
margin-top:5px; |
|||
margin-left:-5px; |
|||
margin-top: 5px; |
|||
margin-left: -5px; |
|||
} |
|||
|
@ -1,48 +1,55 @@ |
|||
/* Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> |
|||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).*/
|
|||
odoo.define('mail_private.tour', function (require) { |
|||
odoo.define("mail_private.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 email = 'mail_private test email'; |
|||
var steps = [{ |
|||
var email = "mail_private test email"; |
|||
var steps = [ |
|||
{ |
|||
trigger: '.o_thread_message strong.o_mail_redirect:contains("Agrolait")', |
|||
content: _t("Open Partners Form"), |
|||
position: 'bottom', |
|||
}, { |
|||
position: "bottom", |
|||
}, |
|||
{ |
|||
trigger: "button.oe_compose_post_private", |
|||
content: _t("Click on Private mail creating button"), |
|||
position: "bottom" |
|||
}, { |
|||
// for some reason (due to tricky renderings) button.oe_composer_uncheck could not be find by the tour manager
|
|||
position: "bottom", |
|||
}, |
|||
{ |
|||
// For some reason (due to tricky renderings) button.oe_composer_uncheck could not be find by the tour manager
|
|||
trigger: ".o_control_panel.o_breadcrumb_full li.active", |
|||
content: _t("Dummy action"), |
|||
}, { |
|||
}, |
|||
{ |
|||
trigger: "button.oe_composer_uncheck", |
|||
extra_trigger: "button.oe_composer_uncheck", |
|||
content: _t("Uncheck all Followers"), |
|||
timeout: 10000, |
|||
}, { |
|||
}, |
|||
{ |
|||
trigger: "div.o_composer_suggested_partners input:first", |
|||
content: _t("Check the first one"), |
|||
}, { |
|||
}, |
|||
{ |
|||
trigger: "textarea.o_composer_text_field:first", |
|||
content: _t("Write some email"), |
|||
run: function() { |
|||
$('textarea.o_composer_text_field:first').val(email); |
|||
$("textarea.o_composer_text_field:first").val(email); |
|||
}, |
|||
}, { |
|||
}, |
|||
{ |
|||
trigger: ".o_composer_send .o_composer_button_send", |
|||
content: _t("Send email"), |
|||
}, { |
|||
}, |
|||
{ |
|||
trigger: ".o_mail_thread .o_thread_message:contains(" + email + ")", |
|||
content: _t("Send email"), |
|||
} |
|||
}, |
|||
]; |
|||
|
|||
tour.register('mail_private_tour', { test: true, url: '/web' }, steps); |
|||
|
|||
tour.register("mail_private_tour", {test: true, url: "/web"}, steps); |
|||
}); |
@ -1,19 +1,25 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<!--Copyright 2016 x620 <https://github.com/x620> |
|||
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).--> |
|||
<odoo> |
|||
<template |
|||
id="assets_backend" |
|||
name="mail_private_assets_backend" |
|||
inherit_id="web.assets_backend"> |
|||
id="assets_backend" |
|||
name="mail_private_assets_backend" |
|||
inherit_id="web.assets_backend" |
|||
> |
|||
<xpath expr="." position="inside"> |
|||
<link rel="stylesheet" href="/mail_private/static/src/css/mail_private.css"/> |
|||
<link |
|||
rel="stylesheet" |
|||
href="/mail_private/static/src/css/mail_private.css" |
|||
/> |
|||
<script |
|||
type="text/javascript" |
|||
src="/mail_private/static/src/js/mail_private.js"></script> |
|||
type="text/javascript" |
|||
src="/mail_private/static/src/js/mail_private.js" |
|||
/> |
|||
<script |
|||
type="text/javascript" |
|||
src="/mail_private/static/src/js/test_private.js"></script> |
|||
type="text/javascript" |
|||
src="/mail_private/static/src/js/test_private.js" |
|||
/> |
|||
</xpath> |
|||
</template> |
|||
</odoo> |
@ -1,18 +1,16 @@ |
|||
{ |
|||
'name': "Mail Recovery", |
|||
'summary': """Backup and recover unsent message""", |
|||
'author': "IT-Projects LLC, Ildar Nasyrov", |
|||
'license': 'LGPL-3', |
|||
"name": "Mail Recovery", |
|||
"summary": """Backup and recover unsent message""", |
|||
"author": "IT-Projects LLC, Ildar Nasyrov", |
|||
"license": "LGPL-3", |
|||
"price": 190.00, |
|||
"currency": "EUR", |
|||
"support": "apps@it-projects.info", |
|||
'website': "https://twitter.com/nasyrov_ildar", |
|||
'category': 'Discuss', |
|||
'images': ['images/mail_recovery.png'], |
|||
'version': '1.0.0', |
|||
'depends': ['mail'], |
|||
'data': [ |
|||
'data.xml', |
|||
], |
|||
"website": "https://twitter.com/nasyrov_ildar", |
|||
"category": "Discuss", |
|||
"images": ["images/mail_recovery.png"], |
|||
"vesion": "11.0.1.0.0", |
|||
"depends": ["mail"], |
|||
"data": ["data.xml"], |
|||
"installable": False, |
|||
} |
@ -1,9 +1,16 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<openerp> |
|||
<data> |
|||
<template id="assets_backend" name="message storage" inherit_id="web.assets_backend"> |
|||
<template |
|||
id="assets_backend" |
|||
name="message storage" |
|||
inherit_id="web.assets_backend" |
|||
> |
|||
<xpath expr="." position="inside"> |
|||
<script type="text/javascript" src="/mail_recovery/static/src/js/mail_recovery.js"></script> |
|||
<script |
|||
type="text/javascript" |
|||
src="/mail_recovery/static/src/js/mail_recovery.js" |
|||
/> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
|
@ -1,51 +1,51 @@ |
|||
odoo.define('mail_reply.reply', function (require) { |
|||
"use strict"; |
|||
odoo.define("mail_reply.reply", function(require) { |
|||
"use strict"; |
|||
|
|||
var core = require('web.core'); |
|||
var chat_manager = require('mail_base.base').chat_manager; |
|||
var core = require("web.core"); |
|||
var chat_manager = require("mail_base.base").chat_manager; |
|||
|
|||
var ChatAction = core.action_registry.get('mail.chat.instant_messaging'); |
|||
var ChatAction = core.action_registry.get("mail.chat.instant_messaging"); |
|||
|
|||
ChatAction.include({ |
|||
_selectMessage: function (message_id) { |
|||
this._super.apply(this, arguments); |
|||
var message = chat_manager.get_message(message_id); |
|||
var subject = ''; |
|||
if (message.record_name){ |
|||
subject = "Re: " + message.record_name; |
|||
} else if (message.subject){ |
|||
subject = "Re: " + message.subject; |
|||
} |
|||
this.extended_composer.set_subject(subject); |
|||
}, |
|||
ChatAction.include({ |
|||
_selectMessage: function(message_id) { |
|||
this._super.apply(this, arguments); |
|||
var message = chat_manager.get_message(message_id); |
|||
var subject = ""; |
|||
if (message.record_name) { |
|||
subject = "Re: " + message.record_name; |
|||
} else if (message.subject) { |
|||
subject = "Re: " + message.subject; |
|||
} |
|||
this.extended_composer.set_subject(subject); |
|||
}, |
|||
|
|||
_onPostMessage: function (message) { |
|||
var self = this; |
|||
var options = this.selected_message |
|||
? {} |
|||
: {channel_id: this.channel.id}; |
|||
if (this.selected_message) { |
|||
message.subtype = 'mail.mt_comment'; |
|||
message.subtype_id = false; |
|||
message.message_type = 'comment'; |
|||
message.content_subtype = 'html'; |
|||
_onPostMessage: function(message) { |
|||
var self = this; |
|||
var options = this.selected_message ? {} : {channel_id: this.channel.id}; |
|||
if (this.selected_message) { |
|||
message.subtype = "mail.mt_comment"; |
|||
message.subtype_id = false; |
|||
message.message_type = "comment"; |
|||
message.content_subtype = "html"; |
|||
|
|||
options.model = this.selected_message.model; |
|||
options.res_id = this.selected_message.res_id; |
|||
options.parent_id = this.selected_message.id; |
|||
} |
|||
chat_manager.post_message(message, options). |
|||
then(function () { |
|||
options.model = this.selected_message.model; |
|||
options.res_id = this.selected_message.res_id; |
|||
options.parent_id = this.selected_message.id; |
|||
} |
|||
chat_manager.post_message(message, options).then(function() { |
|||
if (self.selected_message) { |
|||
self._renderSnackbar('mail.chat.MessageSentSnackbar', {record_name: self.selected_message.record_name}, 5000); |
|||
self._renderSnackbar( |
|||
"mail.chat.MessageSentSnackbar", |
|||
{record_name: self.selected_message.record_name}, |
|||
5000 |
|||
); |
|||
self._unselectMessage(); |
|||
} else { |
|||
self.thread.scroll_to(); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
return chat_manager; |
|||
}, |
|||
}); |
|||
|
|||
return chat_manager; |
|||
}); |
@ -1,10 +1,16 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<template> |
|||
<t t-extend="mail.ChatThread.Message"> |
|||
<t t-jquery='i[class="fa fa-reply o_thread_icon o_thread_message_reply"]' t-operation="replace"> |
|||
<i t-if="message.author_id != 'ODOOBOT' && message.model != 'mail.channel' && options.display_reply_icon" |
|||
<t |
|||
t-jquery='i[class="fa fa-reply o_thread_icon o_thread_message_reply"]' |
|||
t-operation="replace" |
|||
> |
|||
<i |
|||
t-if="message.author_id != 'ODOOBOT' && message.model != 'mail.channel' && options.display_reply_icon" |
|||
class="fa fa-reply o_thread_icon o_thread_message_reply" |
|||
t-att-data-message-id="message.id" title="Reply"/> |
|||
t-att-data-message-id="message.id" |
|||
title="Reply" |
|||
/> |
|||
</t> |
|||
</t> |
|||
</template> |
@ -1,11 +1,16 @@ |
|||
<?xml version="1.0"?> |
|||
<?xml version="1.0" ?> |
|||
<openerp> |
|||
<data> |
|||
<template id="mail_reply_assets_backend" |
|||
name="mail_reply_assets_backend" |
|||
inherit_id="web.assets_backend"> |
|||
<template |
|||
id="mail_reply_assets_backend" |
|||
name="mail_reply_assets_backend" |
|||
inherit_id="web.assets_backend" |
|||
> |
|||
<xpath expr="." position="inside"> |
|||
<script src="/mail_reply/static/src/js/mail_reply.js" type="text/javascript"></script> |
|||
<script |
|||
src="/mail_reply/static/src/js/mail_reply.js" |
|||
type="text/javascript" |
|||
/> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
|
@ -1,2 +1 @@ |
|||
|
|||
from . import test_default |
@ -1,35 +1,39 @@ |
|||
from odoo import api, models, fields |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class MailMessage(models.Model): |
|||
_inherit = 'mail.message' |
|||
_inherit = "mail.message" |
|||
|
|||
sent = fields.Boolean('Sent', compute="_compute_sent", help='Was message sent to someone', store=True) |
|||
sent = fields.Boolean( |
|||
"Sent", compute="_compute_sent", help="Was message sent to someone", store=True |
|||
) |
|||
|
|||
@api.depends('author_id', 'partner_ids') |
|||
@api.depends("author_id", "partner_ids") |
|||
def _compute_sent(self): |
|||
for r in self: |
|||
r_sudo = r.sudo() |
|||
sent = len(r_sudo.partner_ids) > 1 \ |
|||
or len(r_sudo.partner_ids) == 1 \ |
|||
and r_sudo.author_id \ |
|||
and r_sudo.partner_ids[0].id != r_sudo.author_id.id \ |
|||
or r_sudo.model == 'mail.channel' \ |
|||
sent = ( |
|||
len(r_sudo.partner_ids) > 1 |
|||
or len(r_sudo.partner_ids) == 1 |
|||
and r_sudo.author_id |
|||
and r_sudo.partner_ids[0].id != r_sudo.author_id.id |
|||
or r_sudo.model == "mail.channel" |
|||
and r_sudo.res_id |
|||
) |
|||
r.sent = sent |
|||
|
|||
@api.multi |
|||
def message_format(self): |
|||
message_values = super(MailMessage, self).message_format() |
|||
message_index = {message['id']: message for message in message_values} |
|||
message_index = {message["id"]: message for message in message_values} |
|||
for item in self: |
|||
msg = message_index.get(item.id) |
|||
if msg: |
|||
msg['sent'] = item.sent |
|||
msg["sent"] = item.sent |
|||
return message_values |
|||
|
|||
|
|||
class MailComposeMessage(models.TransientModel): |
|||
|
|||
_inherit = 'mail.compose.message' |
|||
sent = fields.Boolean('Sent', help='dummy field to fix inherit error') |
|||
_inherit = "mail.compose.message" |
|||
sent = fields.Boolean("Sent", help="dummy field to fix inherit error") |
@ -1,69 +1,69 @@ |
|||
odoo.define('mail_sent.sent', function (require) { |
|||
"use strict"; |
|||
odoo.define("mail_sent.sent", function(require) { |
|||
"use strict"; |
|||
|
|||
var core = require('web.core'); |
|||
var session = require('web.session'); |
|||
var chat_manager = require('mail_base.base').chat_manager; |
|||
var core = require("web.core"); |
|||
var session = require("web.session"); |
|||
var chat_manager = require("mail_base.base").chat_manager; |
|||
|
|||
var _lt = core._lt; |
|||
var _lt = core._lt; |
|||
|
|||
var ChatAction = core.action_registry.get("mail.chat.instant_messaging"); |
|||
ChatAction.include({ |
|||
init: function(parent, action, options) { |
|||
this._super.apply(this, arguments); |
|||
var channel_name = "channel_sent"; |
|||
// Add channel Sent for show "Send message" button
|
|||
this.channels_show_send_button.push(channel_name); |
|||
// Add channel Sent for enable "display_subject" option
|
|||
this.channels_display_subject.push(channel_name); |
|||
}, |
|||
|
|||
var ChatAction = core.action_registry.get('mail.chat.instant_messaging'); |
|||
ChatAction.include({ |
|||
init: function (parent, action, options) { |
|||
this._super.apply(this, arguments); |
|||
var channel_name = 'channel_sent'; |
|||
// Add channel Sent for show "Send message" button
|
|||
this.channels_show_send_button.push(channel_name); |
|||
// Add channel Sent for enable "display_subject" option
|
|||
this.channels_display_subject.push(channel_name); |
|||
}, |
|||
|
|||
update_message_on_current_channel: function (current_channel_id, message) { |
|||
var result = this._super.apply(this, arguments); |
|||
var sent = current_channel_id === "channel_sent" && !message.is_sent; |
|||
return sent || result; |
|||
} |
|||
}); |
|||
|
|||
// Inherit class and override methods
|
|||
var chat_manager_super = _.clone(chat_manager); |
|||
chat_manager.get_properties = function (msg) { |
|||
var properties = chat_manager_super.get_properties.apply(this, arguments); |
|||
properties.is_sent = this.property_descr("channel_sent", msg, this); |
|||
return properties; |
|||
}; |
|||
update_message_on_current_channel: function(current_channel_id, message) { |
|||
var result = this._super.apply(this, arguments); |
|||
var sent = current_channel_id === "channel_sent" && !message.is_sent; |
|||
return sent || result; |
|||
}, |
|||
}); |
|||
|
|||
chat_manager.set_channel_flags = function (data, msg) { |
|||
chat_manager_super.set_channel_flags.apply(this, arguments); |
|||
if (data.sent && data.author_id[0] === session.partner_id) { |
|||
msg.is_sent = true; |
|||
} |
|||
return msg; |
|||
}; |
|||
// Inherit class and override methods
|
|||
var chat_manager_super = _.clone(chat_manager); |
|||
chat_manager.get_properties = function(msg) { |
|||
var properties = chat_manager_super.get_properties.apply(this, arguments); |
|||
properties.is_sent = this.property_descr("channel_sent", msg, this); |
|||
return properties; |
|||
}; |
|||
|
|||
chat_manager.get_channel_array = function (msg) { |
|||
var arr = chat_manager_super.get_channel_array.apply(this, arguments); |
|||
return arr.concat('channel_sent'); |
|||
}; |
|||
chat_manager.set_channel_flags = function(data, msg) { |
|||
chat_manager_super.set_channel_flags.apply(this, arguments); |
|||
if (data.sent && data.author_id[0] === session.partner_id) { |
|||
msg.is_sent = true; |
|||
} |
|||
return msg; |
|||
}; |
|||
|
|||
chat_manager.get_domain = function (channel) { |
|||
return (channel.id === "channel_sent") |
|||
? [['sent', '=', true],['author_id.user_ids', 'in', [session.uid]]] |
|||
: chat_manager_super.get_domain.apply(this, arguments); |
|||
}; |
|||
chat_manager.get_channel_array = function(msg) { |
|||
var arr = chat_manager_super.get_channel_array.apply(this, arguments); |
|||
return arr.concat("channel_sent"); |
|||
}; |
|||
|
|||
chat_manager.get_domain = function(channel) { |
|||
return channel.id === "channel_sent" |
|||
? [ |
|||
["sent", "=", true], |
|||
["author_id.user_ids", "in", [session.uid]], |
|||
] |
|||
: chat_manager_super.get_domain.apply(this, arguments); |
|||
}; |
|||
|
|||
chat_manager.is_ready.then(function () { |
|||
// Add sent channel
|
|||
chat_manager.add_channel({ |
|||
id: "channel_sent", |
|||
name: _lt("Sent"), |
|||
type: "static" |
|||
chat_manager.is_ready.then(function() { |
|||
// Add sent channel
|
|||
chat_manager.add_channel({ |
|||
id: "channel_sent", |
|||
name: _lt("Sent"), |
|||
type: "static", |
|||
}); |
|||
return $.when(); |
|||
}); |
|||
return $.when(); |
|||
}); |
|||
|
|||
return chat_manager; |
|||
|
|||
return chat_manager; |
|||
}); |
@ -1,2 +1 @@ |
|||
|
|||
from . import test_js |
@ -1,12 +1,14 @@ |
|||
<?xml version="1.0"?> |
|||
<?xml version="1.0" ?> |
|||
<openerp> |
|||
<data> |
|||
<template id="mail_sent_assets_backend" |
|||
name="mail_sent_assets_backend" |
|||
inherit_id="web.assets_backend"> |
|||
<template |
|||
id="mail_sent_assets_backend" |
|||
name="mail_sent_assets_backend" |
|||
inherit_id="web.assets_backend" |
|||
> |
|||
<xpath expr="." position="inside"> |
|||
<link rel="stylesheet" href="/mail_sent/static/src/css/sent.css"/> |
|||
<script src="/mail_sent/static/src/js/sent.js" type="text/javascript"></script> |
|||
<link rel="stylesheet" href="/mail_sent/static/src/css/sent.css" /> |
|||
<script src="/mail_sent/static/src/js/sent.js" type="text/javascript" /> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
|
@ -1,17 +1,20 @@ |
|||
# Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/> |
|||
# 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" |
|||
|
|||
@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,20 +1,20 @@ |
|||
/* 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 email = 'mail_private test email'; |
|||
var steps = [{ |
|||
trigger: 'a.recipient_link:first', |
|||
var steps = [ |
|||
{ |
|||
trigger: "a.recipient_link:first", |
|||
content: _t("Open Partners Form From Recipient Link"), |
|||
position: 'bottom', |
|||
position: "bottom", |
|||
timeout: 70000, |
|||
}]; |
|||
|
|||
tour.register('mail_to_tour', { test: true, url: '/web' }, steps); |
|||
}, |
|||
]; |
|||
|
|||
tour.register("mail_to_tour", {test: true, url: "/web"}, steps); |
|||
}); |
@ -1,17 +1,25 @@ |
|||
<?xml version="1.0"?> |
|||
<?xml version="1.0" ?> |
|||
<!--Copyright 2016 x620 <https://github.com/x620> |
|||
Copyright 2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
|||
Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/> |
|||
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).--> |
|||
<openerp> |
|||
<data> |
|||
<template id="mail_to_assets_backend" |
|||
name="mail_to_assets_backend" |
|||
inherit_id="web.assets_backend"> |
|||
<template |
|||
id="mail_to_assets_backend" |
|||
name="mail_to_assets_backend" |
|||
inherit_id="web.assets_backend" |
|||
> |
|||
<xpath expr="." position="inside"> |
|||
<link rel="stylesheet" href="/mail_to/static/src/css/mail_to.css"/> |
|||
<script src="/mail_to/static/src/js/mail_to.js" type="text/javascript"></script> |
|||
<script src="/mail_to/static/src/js/test_mail_to.js" type="text/javascript"></script> |
|||
<link rel="stylesheet" href="/mail_to/static/src/css/mail_to.css" /> |
|||
<script |
|||
src="/mail_to/static/src/js/mail_to.js" |
|||
type="text/javascript" |
|||
/> |
|||
<script |
|||
src="/mail_to/static/src/js/test_mail_to.js" |
|||
type="text/javascript" |
|||
/> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
|
@ -1,16 +1,16 @@ |
|||
import re |
|||
|
|||
from odoo import http |
|||
from odoo.http import request |
|||
import re |
|||
|
|||
|
|||
class MailMailgun(http.Controller): |
|||
|
|||
@http.route('/mailgun/notify', auth='public', type='http', csrf=False) |
|||
@http.route("/mailgun/notify", auth="public", type="http", csrf=False) |
|||
def mailgun_notify(self, **kw): |
|||
# mailgun notification in json format |
|||
message_url = kw.get('message-url') |
|||
if not re.match('^https://[^/]*api.mailgun.net/', message_url): |
|||
message_url = kw.get("message-url") |
|||
if not re.match("^https://[^/]*api.mailgun.net/", message_url): |
|||
# simple security check failed |
|||
raise Exception('wrong message-url') |
|||
request.env['mail.thread'].sudo().mailgun_fetch_message(message_url) |
|||
return 'ok' |
|||
raise Exception("wrong message-url") |
|||
request.env["mail.thread"].sudo().mailgun_fetch_message(message_url) |
|||
return "ok" |
@ -1,15 +1,15 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<openerp> |
|||
<data noupdate="1"> |
|||
<record id="mailgun_domain_verification" model="ir.cron"> |
|||
<field name="name">Mailgun - domain verification request</field> |
|||
<field name="model_id" ref="model_ir_config_parameter"/> |
|||
<field name="model_id" ref="model_ir_config_parameter" /> |
|||
<field name="interval_number">10</field> |
|||
<field name="interval_type">minutes</field> |
|||
<field name="numbercall">10</field> |
|||
<field name="state">code</field> |
|||
<field name="code">model.mailgun_verify()</field> |
|||
<field name="doall" eval="True"/> |
|||
<field name="doall" eval="True" /> |
|||
</record> |
|||
</data> |
|||
</openerp> |
@ -1,24 +1,28 @@ |
|||
import logging |
|||
|
|||
import requests |
|||
import simplejson |
|||
|
|||
from openerp import models, api |
|||
from odoo import api, models |
|||
|
|||
import logging |
|||
_logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
class IrConfigParameter(models.Model): |
|||
_inherit = ['ir.config_parameter'] |
|||
_inherit = ["ir.config_parameter"] |
|||
|
|||
@api.model |
|||
def mailgun_verify(self): |
|||
verified = self.sudo().get_param('mailgun.verified') |
|||
verified = self.sudo().get_param("mailgun.verified") |
|||
if verified: |
|||
return |
|||
api_key = self.sudo().get_param('mailgun.apikey') |
|||
mail_domain = self.sudo().get_param('mail.catchall.domain') |
|||
api_key = self.sudo().get_param("mailgun.apikey") |
|||
mail_domain = self.sudo().get_param("mail.catchall.domain") |
|||
if api_key and mail_domain: |
|||
url = "https://api.mailgun.net/v3/domains/%s/verify" % mail_domain |
|||
res = requests.put(url, auth=("api", api_key)) |
|||
if res.status_code == 200 and simplejson.loads(res.text)["domain"]["state"] == "active": |
|||
self.sudo().set_param('mailgun.verified', '1') |
|||
if ( |
|||
res.status_code == 200 |
|||
and simplejson.loads(res.text)["domain"]["state"] == "active" |
|||
): |
|||
self.sudo().set_param("mailgun.verified", "1") |
@ -1,17 +1,22 @@ |
|||
import requests |
|||
import logging |
|||
|
|||
from odoo import models, api |
|||
import requests |
|||
|
|||
from odoo import api, models |
|||
|
|||
import logging |
|||
_logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
class MailThread(models.AbstractModel): |
|||
_inherit = 'mail.thread' |
|||
_inherit = "mail.thread" |
|||
|
|||
@api.model |
|||
def mailgun_fetch_message(self, message_url): |
|||
api_key = self.env['ir.config_parameter'].sudo().get_param('mailgun.apikey') |
|||
res = requests.get(message_url, headers={'Accept': 'message/rfc2822'}, auth=('api', api_key), verify=False) |
|||
self.message_process(False, res.json().get('body-mime')) |
|||
api_key = self.env["ir.config_parameter"].sudo().get_param("mailgun.apikey") |
|||
res = requests.get( |
|||
message_url, |
|||
headers={"Accept": "message/rfc2822"}, |
|||
auth=("api", api_key), |
|||
verify=False, |
|||
) |
|||
self.message_process(False, res.json().get("body-mime")) |
@ -1,17 +1,15 @@ |
|||
{ |
|||
'name': "Aggregate messages from company's contacts", |
|||
'version': '1.0.0', |
|||
'author': 'IT-Projects LLC, Ivan Yelizariev', |
|||
'license': 'LGPL-3', |
|||
"name": "Aggregate messages from company's contacts", |
|||
"vesion": "11.0.1.0.0", |
|||
"author": "IT-Projects LLC, Ivan Yelizariev", |
|||
"license": "LGPL-3", |
|||
"price": 70.00, |
|||
"currency": "EUR", |
|||
'category': 'Discuss', |
|||
"category": "Discuss", |
|||
"support": "apps@it-projects.info", |
|||
'website': 'https://twitter.com/yelizariev', |
|||
'images': ['images/child.png', 'images/parent.png'], |
|||
'depends': ['mail'], |
|||
'data': [ |
|||
'views.xml', |
|||
], |
|||
'installable': False |
|||
"website": "https://twitter.com/yelizariev", |
|||
"images": ["images/child.png", "images/parent.png"], |
|||
"depends": ["mail"], |
|||
"data": ["views.xml"], |
|||
"installable": False, |
|||
} |
@ -1,18 +1,20 @@ |
|||
from openerp import api |
|||
from openerp import models |
|||
from odoo import api, models |
|||
|
|||
|
|||
class Partner(models.Model): |
|||
_inherit = 'res.partner' |
|||
_inherit = "res.partner" |
|||
|
|||
@api.multi |
|||
def read(self, fields=None, load='_classic_read'): |
|||
def read(self, fields=None, load="_classic_read"): |
|||
res = super(Partner, self).read(fields=fields, load=load) |
|||
if fields and 'message_ids' in fields: |
|||
if fields and "message_ids" in fields: |
|||
for vals in res: |
|||
partner = self.browse(vals['id']) |
|||
partner = self.browse(vals["id"]) |
|||
if not partner.is_company: |
|||
continue |
|||
domain = [('model', '=', 'res.partner'), ('res_id', 'in', [partner.id] + partner.child_ids.ids)] |
|||
vals['message_ids'] = self.env['mail.message'].search(domain).ids |
|||
domain = [ |
|||
("model", "=", "res.partner"), |
|||
("res_id", "in", [partner.id] + partner.child_ids.ids), |
|||
] |
|||
vals["message_ids"] = self.env["mail.message"].search(domain).ids |
|||
return res |
@ -1,3 +1,3 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<openerp><data> |
|||
</data></openerp> |
@ -1,18 +1,23 @@ |
|||
|
|||
from openerp import models, fields, api |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class ResPartner(models.Model): |
|||
_inherit = 'res.partner' |
|||
_inherit = "res.partner" |
|||
mails_to = fields.Integer(compute="_compute_mails_to") |
|||
mails_from = fields.Integer(compute="_compute_mails_from") |
|||
|
|||
@api.multi |
|||
def _compute_mails_to(self): |
|||
for r in self: |
|||
r.mails_to = self.env['mail.message'].sudo().search_count([('partner_ids', 'in', r.id)]) |
|||
r.mails_to = ( |
|||
self.env["mail.message"] |
|||
.sudo() |
|||
.search_count([("partner_ids", "in", r.id)]) |
|||
) |
|||
|
|||
@api.multi |
|||
def _compute_mails_from(self): |
|||
for r in self: |
|||
r.mails_from = self.env['mail.message'].sudo().search_count([('author_id', '=', r.id)]) |
|||
r.mails_from = ( |
|||
self.env["mail.message"].sudo().search_count([("author_id", "=", r.id)]) |
|||
) |
@ -1,36 +1,38 @@ |
|||
odoo.define('res_partner_mails_count.res_partner_mails_count_tour', function (require) { |
|||
'use strict'; |
|||
var Core = require('web.core'); |
|||
var Tour = require('web.Tour'); |
|||
odoo.define("res_partner_mails_count.res_partner_mails_count_tour", function(require) { |
|||
"use strict"; |
|||
var Core = require("web.core"); |
|||
var Tour = require("web.Tour"); |
|||
var _t = Core._t; |
|||
|
|||
Tour.register({ |
|||
id: 'mails_count_tour', |
|||
id: "mails_count_tour", |
|||
name: _t("Mails count Tour"), |
|||
mode: 'test', |
|||
path: '/web?res_partner_mails_count=tutorial#id=3&view_type=form&model=res.partner', |
|||
mode: "test", |
|||
path: |
|||
"/web?res_partner_mails_count=tutorial#id=3&view_type=form&model=res.partner", |
|||
steps: [ |
|||
{ |
|||
title: _t("Mails count tutorial"), |
|||
content: _t("Let's see how mails count work."), |
|||
popover: { next: _t("Start Tutorial"), end: _t("Skip") }, |
|||
title: _t("Mails count tutorial"), |
|||
content: _t("Let's see how mails count work."), |
|||
popover: {next: _t("Start Tutorial"), end: _t("Skip")}, |
|||
}, |
|||
{ |
|||
title: _t("New fields"), |
|||
content: _t("Here is new fields with mails counters. Press one of it."), |
|||
element: '.mails_to', |
|||
waitFor: '.mails_to:visible', |
|||
title: _t("New fields"), |
|||
content: _t("Here is new fields with mails counters. Press one of it."), |
|||
element: ".mails_to", |
|||
waitFor: ".mails_to:visible", |
|||
}, |
|||
{ |
|||
title: _t("Done"), |
|||
placement: 'top', |
|||
waitNot: '.mails_to:visible', |
|||
waitFor: '.o_mail_thread', |
|||
element: '.o_mail_thread', |
|||
content: _t("Message are found. <br/>Enjoy your day! <br/> <br/><a href='https://www.it-projects.info/apps' target='_blank'>IT-Projects LLC</a> team "), |
|||
placement: "top", |
|||
waitNot: ".mails_to:visible", |
|||
waitFor: ".o_mail_thread", |
|||
element: ".o_mail_thread", |
|||
content: _t( |
|||
"Message are found. <br/>Enjoy your day! <br/> <br/><a href='https://www.it-projects.info/apps' target='_blank'>IT-Projects LLC</a> team " |
|||
), |
|||
popover: {next: _t("Close Tutorial")}, |
|||
}, |
|||
] |
|||
], |
|||
}); |
|||
|
|||
}); |
@ -1,3 +1,3 @@ |
|||
|
|||
from . import test_mail |
|||
|
|||
# from . import test_phantom |
@ -1,33 +1,62 @@ |
|||
|
|||
from openerp.tests.common import TransactionCase |
|||
from odoo.tests.common import TransactionCase |
|||
|
|||
|
|||
class TestMessageCount(TransactionCase): |
|||
post_install = True |
|||
|
|||
def test_count(self): |
|||
new_partner1 = self.env['res.partner'].sudo().create({'name': 'rpmc Test Partner one', 'email': 'tt@tt', 'notify_email': 'always'}) |
|||
new_partner2 = self.env['res.partner'].sudo().create({'name': 'rpmc Test Partner two', 'email': 'rr@rr', 'notify_email': 'always'}) |
|||
self.assertEqual(new_partner1.mails_to, 0, 'rpmc: new partner have mails_to != 0') |
|||
mail_compose = self.env['mail.compose.message'] |
|||
new_partner1 = ( |
|||
self.env["res.partner"] |
|||
.sudo() |
|||
.create( |
|||
{ |
|||
"name": "rpmc Test Partner one", |
|||
"email": "tt@tt", |
|||
"notify_email": "always", |
|||
} |
|||
) |
|||
) |
|||
new_partner2 = ( |
|||
self.env["res.partner"] |
|||
.sudo() |
|||
.create( |
|||
{ |
|||
"name": "rpmc Test Partner two", |
|||
"email": "rr@rr", |
|||
"notify_email": "always", |
|||
} |
|||
) |
|||
) |
|||
self.assertEqual( |
|||
new_partner1.mails_to, 0, "rpmc: new partner have mails_to != 0" |
|||
) |
|||
mail_compose = self.env["mail.compose.message"] |
|||
compose = mail_compose.with_context( |
|||
{"default_composition_mode": "comment"} |
|||
).create( |
|||
{ |
|||
'default_composition_mode': 'comment', |
|||
}).create( |
|||
{ |
|||
'subject': 'test subj', |
|||
'body': 'test body', |
|||
'partner_ids': [(4, new_partner2.id)], |
|||
'email_from': 'tt@tt', |
|||
'author_id': new_partner1.id |
|||
}) |
|||
"subject": "test subj", |
|||
"body": "test body", |
|||
"partner_ids": [(4, new_partner2.id)], |
|||
"email_from": "tt@tt", |
|||
"author_id": new_partner1.id, |
|||
} |
|||
) |
|||
compose.send_mail() |
|||
self.assertEqual(new_partner1.mails_to, 0) |
|||
self.assertEqual(new_partner1.mails_from, 1, 'rpmc: one message but mails_from != 1') |
|||
self.assertEqual(new_partner2.mails_to, 1, 'rpmc: one message but mails_to != 1') |
|||
self.assertEqual( |
|||
new_partner1.mails_from, 1, "rpmc: one message but mails_from != 1" |
|||
) |
|||
self.assertEqual( |
|||
new_partner2.mails_to, 1, "rpmc: one message but mails_to != 1" |
|||
) |
|||
self.assertEqual(new_partner2.mails_from, 0) |
|||
compose.send_mail() |
|||
self.assertEqual(new_partner1.mails_to, 0) |
|||
self.assertEqual(new_partner1.mails_from, 2, 'rpmc: one message but mails_from != 2') |
|||
self.assertEqual(new_partner2.mails_to, 2, 'rpmc: one message but mails_to != 2') |
|||
self.assertEqual( |
|||
new_partner1.mails_from, 2, "rpmc: one message but mails_from != 2" |
|||
) |
|||
self.assertEqual( |
|||
new_partner2.mails_to, 2, "rpmc: one message but mails_to != 2" |
|||
) |
|||
self.assertEqual(new_partner2.mails_from, 0) |
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue