Browse Source
Merge pull request #261 from yelizariev/13.0-pre-commit-cleanups
Merge pull request #261 from yelizariev/13.0-pre-commit-cleanups
commit is created by 👷♂️ Merge Bot: https://odoo-devops.readthedocs.io/en/latest/git/github-merge-bot.htmlpull/265/head
Mitchell Admin
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
106 changed files with 2182 additions and 1630 deletions
-
6.DINAR/image/README.md
-
1.DINAR/image/src/addons.yaml
-
9.github/workflows/main.yml
-
2.isort.cfg
-
3.travis.yml
-
24mail_all/__manifest__.py
-
47mail_all/static/src/js/mail_all.js
-
32mail_all/static/src/js/test_mail_all.js
-
11mail_all/static/src/xml/menu.xml
-
13mail_all/tests/test_js.py
-
20mail_all/views/templates.xml
-
23mail_archives/__manifest__.py
-
87mail_archives/static/src/js/archives.js
-
12mail_archives/static/src/xml/menu.xml
-
1mail_archives/tests/__init__.py
-
17mail_archives/tests/test_js.py
-
18mail_archives/views/templates.xml
-
1mail_base/__init__.py
-
18mail_base/__manifest__.py
-
7mail_base/controllers/main.py
-
21mail_base/models.py
-
1mail_base/tests/__init__.py
-
7mail_base/tests/test_default.py
-
10mail_base/views/templates.xml
-
26mail_check_immediately/__manifest__.py
-
51mail_check_immediately/models.py
-
45mail_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
-
158mail_fix_553/mail_fix_553.py
-
33mail_move_message/__manifest__.py
-
5mail_move_message/controllers/main.py
-
3mail_move_message/data/mail_move_message_data.xml
-
513mail_move_message/mail_move_message_models.py
-
137mail_move_message/mail_move_message_views.xml
-
5mail_move_message/static/src/css/mail_move_message.css
-
145mail_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
-
15mail_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
-
18mail_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
-
141mail_multi_website/tests/test_render.py
-
43mail_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
-
15mail_private/full_composer_wizard.xml
-
78mail_private/models.py
-
253mail_private/static/src/js/mail_private.js
-
67mail_private/static/src/js/test_private.js
-
14mail_private/static/src/xml/mail_private.xml
-
11mail_private/template.xml
-
12mail_private/tests/test_js.py
-
22mail_recovery/__manifest__.py
-
13mail_recovery/data.xml
-
15mail_recovery/static/src/js/mail_recovery.js
-
16mail_reply/__manifest__.py
-
48mail_reply/static/src/js/mail_reply.js
-
14mail_reply/static/src/xml/reply_button.xml
-
13mail_reply/templates.xml
-
1mail_reply/tests/__init__.py
-
7mail_reply/tests/test_default.py
-
23mail_sent/__manifest__.py
-
38mail_sent/models.py
-
81mail_sent/static/src/js/sent.js
-
15mail_sent/static/src/xml/menu.xml
-
1mail_sent/tests/__init__.py
-
17mail_sent/tests/test_js.py
-
12mail_sent/views/templates.xml
-
16mail_to/__manifest__.py
-
15mail_to/static/src/xml/recipient.xml
-
10mail_to/templates.xml
-
47mail_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
-
36res_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
-
17res_partner_mails_count/tests/test_phantom.py
-
2res_partner_mails_count/views/res_partner_mails_count.xml
@ -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,29 +1,33 @@ |
|||||
/* # Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> |
/* # Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> |
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */
|
||||
odoo.define('mail_all.tour', function (require) { |
|
||||
|
odoo.define("mail_all.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 = [{ |
|
||||
|
var steps = [ |
||||
|
{ |
||||
trigger: 'a.full[href="#"]', |
trigger: 'a.full[href="#"]', |
||||
content: _t("Click to open app list"), |
content: _t("Click to open app list"), |
||||
position: 'bottom', |
|
||||
}, { |
|
||||
|
position: "bottom", |
||||
|
}, |
||||
|
{ |
||||
trigger: 'a.dropdown-item.o_app:contains("Discuss")', |
trigger: 'a.dropdown-item.o_app:contains("Discuss")', |
||||
content: _t("Click to enter menu discuss"), |
content: _t("Click to enter menu discuss"), |
||||
position: 'bottom', |
|
||||
}, { |
|
||||
|
position: "bottom", |
||||
|
}, |
||||
|
{ |
||||
content: _t("Open All Messages"), |
content: _t("Open All Messages"), |
||||
trigger: '.o_channel_name.mail_all', |
|
||||
}, { |
|
||||
|
trigger: ".o_channel_name.mail_all", |
||||
|
}, |
||||
|
{ |
||||
content: _t("Check that All Messages are opened"), |
content: _t("Check that All Messages are opened"), |
||||
trigger: '.o_mail_discuss_title_main.o_mail_mailbox_title_all.o_mail_discuss_item.o_active', |
|
||||
}]; |
|
||||
|
|
||||
tour.register('tour_mail_all', { test: true, url: '/web' }, steps); |
|
||||
|
trigger: |
||||
|
".o_mail_discuss_title_main.o_mail_mailbox_title_all.o_mail_discuss_item.o_active", |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
tour.register("tour_mail_all", {test: true, url: "/web"}, steps); |
||||
}); |
}); |
@ -1,16 +1,24 @@ |
|||||
<?xml version="1.0"?> |
|
||||
|
<?xml version="1.0" ?> |
||||
<!--# Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
<!--# Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
||||
# Copyright 2018 Artyom Losev <https://it-projects.info/team/ArtyomLosev> |
# Copyright 2018 Artyom Losev <https://it-projects.info/team/ArtyomLosev> |
||||
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> |
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> |
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). --> |
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). --> |
||||
<odoo> |
<odoo> |
||||
<template id="mail_all_assets_backend" |
|
||||
|
<template |
||||
|
id="mail_all_assets_backend" |
||||
name="mail_all_assets_backend" |
name="mail_all_assets_backend" |
||||
inherit_id="web.assets_backend"> |
|
||||
|
inherit_id="web.assets_backend" |
||||
|
> |
||||
<xpath expr="." position="inside"> |
<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> |
|
||||
<script src="/mail_all/static/src/js/test_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" |
||||
|
/> |
||||
|
<script |
||||
|
src="/mail_all/static/src/js/test_mail_all.js" |
||||
|
type="text/javascript" |
||||
|
/> |
||||
</xpath> |
</xpath> |
||||
</template> |
</template> |
||||
</odoo> |
</odoo> |
@ -1,2 +1 @@ |
|||||
|
|
||||
from . import test_js |
from . import test_js |
@ -1,12 +1,20 @@ |
|||||
<?xml version="1.0"?> |
|
||||
|
<?xml version="1.0" ?> |
||||
<openerp> |
<openerp> |
||||
<data> |
<data> |
||||
<template id="res_partner_mails_count_assets_backend" |
|
||||
|
<template |
||||
|
id="res_partner_mails_count_assets_backend" |
||||
name="res_partner_mails_count_assets_backend" |
name="res_partner_mails_count_assets_backend" |
||||
inherit_id="web.assets_backend"> |
|
||||
|
inherit_id="web.assets_backend" |
||||
|
> |
||||
<xpath expr="." position="inside"> |
<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> |
</xpath> |
||||
</template> |
</template> |
||||
</data> |
</data> |
||||
|
@ -1,3 +1,2 @@ |
|||||
|
|
||||
from . import models |
from . import models |
||||
from . import controllers |
from . import controllers |
@ -1,28 +1,29 @@ |
|||||
|
|
||||
from openerp import api, models |
|
||||
|
from odoo import models |
||||
|
|
||||
|
|
||||
class MailMessage(models.Model): |
class MailMessage(models.Model): |
||||
_inherit = 'mail.message' |
|
||||
|
_inherit = "mail.message" |
||||
|
|
||||
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 id in triplet[2]: |
for id in triplet[2]: |
||||
values['partner_ids'].append((4, id, False)) |
|
||||
|
values["partner_ids"].append((4, id, False)) |
||||
return super(MailMessage, self).write(values) |
return super(MailMessage, self).write(values) |
||||
|
|
||||
|
|
||||
class MailComposer(models.TransientModel): |
class MailComposer(models.TransientModel): |
||||
|
|
||||
_inherit = 'mail.compose.message' |
|
||||
|
_inherit = "mail.compose.message" |
||||
|
|
||||
def send_mail(self, auto_commit=False): |
def send_mail(self, auto_commit=False): |
||||
res = super(MailComposer, self).send_mail(auto_commit=auto_commit) |
res = super(MailComposer, self).send_mail(auto_commit=auto_commit) |
||||
notification = {} |
notification = {} |
||||
self.env['bus.bus'].sendone((self._cr.dbname, 'mail_base.mail_sent'), notification) |
|
||||
|
self.env["bus.bus"].sendone( |
||||
|
(self._cr.dbname, "mail_base.mail_sent"), notification |
||||
|
) |
||||
|
|
||||
return res |
return res |
@ -1,2 +1 @@ |
|||||
|
|
||||
from . import test_default |
from . import test_default |
@ -1,11 +1,13 @@ |
|||||
<?xml version="1.0"?> |
|
||||
|
<?xml version="1.0" ?> |
||||
<openerp> |
<openerp> |
||||
<data> |
<data> |
||||
<template id="mail_base_assets_backend" |
|
||||
|
<template |
||||
|
id="mail_base_assets_backend" |
||||
name="mail_base_assets_backend" |
name="mail_base_assets_backend" |
||||
inherit_id="web.assets_backend"> |
|
||||
|
inherit_id="web.assets_backend" |
||||
|
> |
||||
<xpath expr="." position="inside"> |
<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> |
</xpath> |
||||
</template> |
</template> |
||||
</data> |
</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": "13.0.1.0.1", |
||||
|
"author": "IT-Projects LLC, Ivan Yelizariev", |
||||
|
"license": "LGPL-3", |
||||
"category": "Discuss", |
"category": "Discuss", |
||||
"support": "apps@it-projects.info", |
"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> |
<openerp> |
||||
<data> |
<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"> |
<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> |
</xpath> |
||||
</template> |
</template> |
||||
</data> |
</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 Ildar Nasyrov <https://it-projects.info/team/iledarn> |
||||
# Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
# Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
||||
# Copyright 2016 Pavel Romanchenko |
# Copyright 2016 Pavel Romanchenko |
||||
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> |
# Copyright 2018 Kolushov Alexandr <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).--> |
||||
|
|
||||
<template> |
<template> |
||||
<t t-extend="mail.ChatThread.Message"> |
<t t-extend="mail.ChatThread.Message"> |
||||
<t t-jquery='p.o_mail_info span:last-child i:first-child' t-operation="before"> |
<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> |
||||
</t> |
</t> |
||||
</template> |
</template> |
@ -1,3 +1,2 @@ |
|||||
# 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). |
||||
from . import test_mail_move |
from . import test_mail_move |
||||
|
|
@ -1,19 +1,19 @@ |
|||||
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
||||
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> |
# Copyright 2018 Kolushov Alexandr <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). |
||||
from odoo import models, api |
|
||||
|
from odoo import models |
||||
|
|
||||
|
|
||||
class IrProperty(models.Model): |
class IrProperty(models.Model): |
||||
_inherit = 'ir.property' |
|
||||
|
_inherit = "ir.property" |
||||
|
|
||||
def write(self, vals): |
def write(self, vals): |
||||
res = super(IrProperty, self).write(vals) |
res = super(IrProperty, self).write(vals) |
||||
field_object_list = [ |
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: |
for fobj in field_object_list: |
||||
self._update_db_value_website_dependent(fobj) |
self._update_db_value_website_dependent(fobj) |
||||
|
@ -1,16 +1,16 @@ |
|||||
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
||||
# 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). |
||||
from odoo import models, fields |
|
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
class Message(models.Model): |
class Message(models.Model): |
||||
_inherit = 'mail.message' |
|
||||
|
_inherit = "mail.message" |
||||
|
|
||||
def _default_mail_server_id(self): |
def _default_mail_server_id(self): |
||||
website = self.env.context.get('website_id') |
|
||||
|
website = self.env.context.get("website_id") |
||||
if not website: |
if not website: |
||||
return |
return |
||||
website = self.env['website'].sudo().browse(website) |
|
||||
|
website = self.env["website"].sudo().browse(website) |
||||
return website.mail_server_id.id |
return website.mail_server_id.id |
||||
|
|
||||
mail_server_id = fields.Many2one(default=_default_mail_server_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> |
# Copyright 2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). |
# 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): |
class Website(models.Model): |
||||
_inherit = "website" |
_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> |
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
||||
# 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). |
||||
from odoo import models, fields |
|
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
class MailTest(models.Model): |
class MailTest(models.Model): |
||||
_inherit = 'mail.test.simple' |
|
||||
|
_inherit = "mail.test.simple" |
||||
|
|
||||
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> |
<!-- Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
||||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). --> |
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). --> |
||||
<odoo> |
<odoo> |
||||
<record id="view_website_multi_mail_form" model="ir.ui.view"> |
<record id="view_website_multi_mail_form" model="ir.ui.view"> |
||||
<field name="model">website</field> |
<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"> |
<field name="arch" type="xml"> |
||||
<xpath expr="//field[@name='default_lang_id']" position="after"> |
<xpath expr="//field[@name='default_lang_id']" position="after"> |
||||
<field name="mail_server_id"/> |
|
||||
|
<field name="mail_server_id" /> |
||||
</xpath> |
</xpath> |
||||
</field> |
</field> |
||||
</record> |
</record> |
||||
|
@ -1,20 +1,22 @@ |
|||||
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> |
||||
# 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). |
||||
from odoo import models, api |
|
||||
|
from odoo import api, models |
||||
from odoo.http import request |
from odoo.http import request |
||||
|
|
||||
|
|
||||
class MailComposer(models.TransientModel): |
class MailComposer(models.TransientModel): |
||||
|
|
||||
_inherit = 'mail.compose.message' |
|
||||
|
_inherit = "mail.compose.message" |
||||
|
|
||||
@api.model |
@api.model |
||||
def create(self, vals): |
def create(self, vals): |
||||
"""Workaround for https://github.com/odoo/odoo/pull/26589""" |
"""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: |
if not website: |
||||
website = self.env['website'].get_current_website() |
|
||||
|
website = self.env["website"].get_current_website() |
||||
if website: |
if website: |
||||
self = self.with_context(website_id=website.id) |
self = self.with_context(website_id=website.id) |
||||
return super(MailComposer, self).create(vals) |
return super(MailComposer, self).create(vals) |
@ -1,61 +1,72 @@ |
|||||
/* Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> |
/* Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> |
||||
Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
|
Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
|
||||
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_private.tour', function(require) { |
|
||||
"use strict"; |
|
||||
|
odoo.define("mail_private.tour", function(require) { |
||||
|
"use strict"; |
||||
|
|
||||
var core = require('web.core'); |
|
||||
var tour = require('web_tour.tour'); |
|
||||
|
var core = require("web.core"); |
||||
|
var tour = require("web_tour.tour"); |
||||
var _t = core._t; |
var _t = core._t; |
||||
|
|
||||
var email = 'mail_private test email'; |
|
||||
var steps = [tour.STEPS.SHOW_APPS_MENU_ITEM, { |
|
||||
trigger: '.fa.fa-cog.o_mail_channel_settings', |
|
||||
content: _t('Select channel settings'), |
|
||||
position: 'bottom', |
|
||||
}, { |
|
||||
|
var email = "mail_private test email"; |
||||
|
var steps = [ |
||||
|
tour.STEPS.SHOW_APPS_MENU_ITEM, |
||||
|
{ |
||||
|
trigger: ".fa.fa-cog.o_mail_channel_settings", |
||||
|
content: _t("Select channel settings"), |
||||
|
position: "bottom", |
||||
|
}, |
||||
|
{ |
||||
trigger: '.nav-link:contains("Members")', |
trigger: '.nav-link:contains("Members")', |
||||
content: _t('Go to the list of subscribers'), |
|
||||
position: 'bottom', |
|
||||
}, { |
|
||||
|
content: _t("Go to the list of subscribers"), |
||||
|
position: "bottom", |
||||
|
}, |
||||
|
{ |
||||
trigger: '.o_data_cell:contains("YourCompany, Marc Demo")', |
trigger: '.o_data_cell:contains("YourCompany, Marc Demo")', |
||||
content: _t("Select a user"), |
content: _t("Select a user"), |
||||
position: "bottom", |
position: "bottom", |
||||
}, { |
|
||||
|
}, |
||||
|
{ |
||||
trigger: '.o_form_uri.o_field_widget:contains("YourCompany, Marc Demo")', |
trigger: '.o_form_uri.o_field_widget:contains("YourCompany, Marc Demo")', |
||||
content: _t("Go to user page"), |
content: _t("Go to user page"), |
||||
position: "bottom" |
|
||||
}, { |
|
||||
|
position: "bottom", |
||||
|
}, |
||||
|
{ |
||||
trigger: "button.oe_compose_post_private", |
trigger: "button.oe_compose_post_private", |
||||
content: _t("Click on Private mail creating button"), |
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", |
trigger: ".o_control_panel.o_breadcrumb_full li.active", |
||||
content: _t("Dummy action"), |
content: _t("Dummy action"), |
||||
}, { |
|
||||
|
}, |
||||
|
{ |
||||
trigger: "button.oe_composer_uncheck", |
trigger: "button.oe_composer_uncheck", |
||||
extra_trigger: "button.oe_composer_uncheck", |
extra_trigger: "button.oe_composer_uncheck", |
||||
content: _t("Uncheck all Followers"), |
content: _t("Uncheck all Followers"), |
||||
timeout: 10000, |
timeout: 10000, |
||||
}, { |
|
||||
|
}, |
||||
|
{ |
||||
trigger: "div.o_composer_suggested_partners", |
trigger: "div.o_composer_suggested_partners", |
||||
content: _t("Check the first one"), |
content: _t("Check the first one"), |
||||
}, { |
|
||||
|
}, |
||||
|
{ |
||||
trigger: "textarea.o_composer_text_field:first", |
trigger: "textarea.o_composer_text_field:first", |
||||
content: _t("Write some email"), |
content: _t("Write some email"), |
||||
run: function() { |
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", |
trigger: ".o_composer_send .o_composer_button_send", |
||||
content: _t("Send email"), |
content: _t("Send email"), |
||||
}, { |
|
||||
|
}, |
||||
|
{ |
||||
trigger: ".o_mail_thread .o_thread_message:contains(" + email + ")", |
trigger: ".o_mail_thread .o_thread_message:contains(" + email + ")", |
||||
content: _t("Send 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,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": 95.00, |
"price": 95.00, |
||||
"currency": "EUR", |
"currency": "EUR", |
||||
"support": "apps@it-projects.info", |
"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": "13.0.1.0.0", |
||||
|
"depends": ["mail"], |
||||
|
"data": ["data.xml"], |
||||
"installable": False, |
"installable": False, |
||||
} |
} |
@ -1,9 +1,16 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
|
<?xml version="1.0" encoding="utf-8" ?> |
||||
<openerp> |
<openerp> |
||||
<data> |
<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"> |
<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> |
</xpath> |
||||
</template> |
</template> |
||||
</data> |
</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) { |
|
||||
|
ChatAction.include({ |
||||
|
_selectMessage: function(message_id) { |
||||
this._super.apply(this, arguments); |
this._super.apply(this, arguments); |
||||
var message = chat_manager.get_message(message_id); |
var message = chat_manager.get_message(message_id); |
||||
var subject = ''; |
|
||||
if (message.record_name){ |
|
||||
|
var subject = ""; |
||||
|
if (message.record_name) { |
||||
subject = "Re: " + message.record_name; |
subject = "Re: " + message.record_name; |
||||
} else if (message.subject){ |
|
||||
|
} else if (message.subject) { |
||||
subject = "Re: " + message.subject; |
subject = "Re: " + message.subject; |
||||
} |
} |
||||
this.extended_composer.set_subject(subject); |
this.extended_composer.set_subject(subject); |
||||
}, |
}, |
||||
|
|
||||
_onPostMessage: function (message) { |
|
||||
|
_onPostMessage: function(message) { |
||||
var self = this; |
var self = this; |
||||
var options = this.selected_message |
|
||||
? {} |
|
||||
: {channel_id: this.channel.id}; |
|
||||
|
var options = this.selected_message ? {} : {channel_id: this.channel.id}; |
||||
if (this.selected_message) { |
if (this.selected_message) { |
||||
message.subtype = 'mail.mt_comment'; |
|
||||
|
message.subtype = "mail.mt_comment"; |
||||
message.subtype_id = false; |
message.subtype_id = false; |
||||
message.message_type = 'comment'; |
|
||||
message.content_subtype = 'html'; |
|
||||
|
message.message_type = "comment"; |
||||
|
message.content_subtype = "html"; |
||||
|
|
||||
options.model = this.selected_message.model; |
options.model = this.selected_message.model; |
||||
options.res_id = this.selected_message.res_id; |
options.res_id = this.selected_message.res_id; |
||||
options.parent_id = this.selected_message.id; |
options.parent_id = this.selected_message.id; |
||||
} |
} |
||||
chat_manager.post_message(message, options). |
|
||||
then(function () { |
|
||||
|
chat_manager.post_message(message, options).then(function() { |
||||
if (self.selected_message) { |
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(); |
self._unselectMessage(); |
||||
} else { |
} else { |
||||
self.thread.scroll_to(); |
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> |
<template> |
||||
<t t-extend="mail.ChatThread.Message"> |
<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" |
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> |
||||
</t> |
</t> |
||||
</template> |
</template> |
@ -1,11 +1,16 @@ |
|||||
<?xml version="1.0"?> |
|
||||
|
<?xml version="1.0" ?> |
||||
<openerp> |
<openerp> |
||||
<data> |
<data> |
||||
<template id="mail_reply_assets_backend" |
|
||||
|
<template |
||||
|
id="mail_reply_assets_backend" |
||||
name="mail_reply_assets_backend" |
name="mail_reply_assets_backend" |
||||
inherit_id="web.assets_backend"> |
|
||||
|
inherit_id="web.assets_backend" |
||||
|
> |
||||
<xpath expr="." position="inside"> |
<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> |
</xpath> |
||||
</template> |
</template> |
||||
</data> |
</data> |
||||
|
@ -1,2 +1 @@ |
|||||
|
|
||||
from . import test_default |
from . import test_default |
@ -1,45 +1,43 @@ |
|||||
from odoo import api, models, fields |
|
||||
|
from odoo import api, fields, models |
||||
|
|
||||
|
|
||||
class MailMessage(models.Model): |
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', 'channel_ids') |
|
||||
|
@api.depends("author_id", "partner_ids", "channel_ids") |
||||
def _compute_sent(self): |
def _compute_sent(self): |
||||
for r in self: |
for r in self: |
||||
r_sudo = r.sudo() |
r_sudo = r.sudo() |
||||
recipient_ids = r_sudo.partner_ids |
recipient_ids = r_sudo.partner_ids |
||||
author_id = r_sudo.author_id |
author_id = r_sudo.author_id |
||||
res_id = r_sudo.model and r_sudo.res_id and r_sudo.env[r_sudo.model].browse(r_sudo.res_id) |
|
||||
|
res_id = ( |
||||
|
r_sudo.model |
||||
|
and r_sudo.res_id |
||||
|
and r_sudo.env[r_sudo.model].browse(r_sudo.res_id) |
||||
|
) |
||||
sent = author_id and ( |
sent = author_id and ( |
||||
len(recipient_ids) > 1 |
len(recipient_ids) > 1 |
||||
or ( |
|
||||
len(recipient_ids) == 1 |
|
||||
and recipient_ids[0].id != author_id.id |
|
||||
) |
|
||||
or ( |
|
||||
len(r_sudo.channel_ids) |
|
||||
) |
|
||||
or ( |
|
||||
res_id |
|
||||
and len(res_id.message_partner_ids - author_id) > 0 |
|
||||
) |
|
||||
|
or (len(recipient_ids) == 1 and recipient_ids[0].id != author_id.id) |
||||
|
or (len(r_sudo.channel_ids)) |
||||
|
or (res_id and len(res_id.message_partner_ids - author_id) > 0) |
||||
) |
) |
||||
r.sent = sent |
r.sent = sent |
||||
|
|
||||
def message_format(self): |
def message_format(self): |
||||
message_values = super(MailMessage, self).message_format() |
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: |
for item in self: |
||||
msg = message_index.get(item.id) |
msg = message_index.get(item.id) |
||||
if msg: |
if msg: |
||||
msg['sent'] = item.sent |
|
||||
|
msg["sent"] = item.sent |
||||
return message_values |
return message_values |
||||
|
|
||||
|
|
||||
class MailComposeMessage(models.TransientModel): |
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,2 +1 @@ |
|||||
|
|
||||
from . import test_js |
from . import test_js |
@ -1,12 +1,14 @@ |
|||||
<?xml version="1.0"?> |
|
||||
|
<?xml version="1.0" ?> |
||||
<openerp> |
<openerp> |
||||
<data> |
<data> |
||||
<template id="mail_sent_assets_backend" |
|
||||
|
<template |
||||
|
id="mail_sent_assets_backend" |
||||
name="mail_sent_assets_backend" |
name="mail_sent_assets_backend" |
||||
inherit_id="web.assets_backend"> |
|
||||
|
inherit_id="web.assets_backend" |
||||
|
> |
||||
<xpath expr="." position="inside"> |
<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> |
</xpath> |
||||
</template> |
</template> |
||||
</data> |
</data> |
||||
|
@ -1,11 +1,13 @@ |
|||||
<?xml version="1.0"?> |
|
||||
|
<?xml version="1.0" ?> |
||||
<openerp> |
<openerp> |
||||
<data> |
<data> |
||||
<template id="mail_to_assets_backend" |
|
||||
|
<template |
||||
|
id="mail_to_assets_backend" |
||||
name="mail_to_assets_backend" |
name="mail_to_assets_backend" |
||||
inherit_id="web.assets_backend"> |
|
||||
|
inherit_id="web.assets_backend" |
||||
|
> |
||||
<xpath expr="." position="inside"> |
<xpath expr="." position="inside"> |
||||
<link rel="stylesheet" href="/mail_to/static/src/css/mail_to.css"/> |
|
||||
|
<link rel="stylesheet" href="/mail_to/static/src/css/mail_to.css" /> |
||||
</xpath> |
</xpath> |
||||
</template> |
</template> |
||||
</data> |
</data> |
||||
|
@ -1,16 +1,16 @@ |
|||||
|
import re |
||||
|
|
||||
from odoo import http |
from odoo import http |
||||
from odoo.http import request |
from odoo.http import request |
||||
import re |
|
||||
|
|
||||
|
|
||||
class MailMailgun(http.Controller): |
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): |
def mailgun_notify(self, **kw): |
||||
# mailgun notification in json format |
# 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 |
# 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> |
<openerp> |
||||
<data noupdate="1"> |
<data noupdate="1"> |
||||
<record id="mailgun_domain_verification" model="ir.cron"> |
<record id="mailgun_domain_verification" model="ir.cron"> |
||||
<field name="name">Mailgun - domain verification request</field> |
<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_number">10</field> |
||||
<field name="interval_type">minutes</field> |
<field name="interval_type">minutes</field> |
||||
<field name="numbercall">10</field> |
<field name="numbercall">10</field> |
||||
<field name="state">code</field> |
<field name="state">code</field> |
||||
<field name="code">model.mailgun_verify()</field> |
<field name="code">model.mailgun_verify()</field> |
||||
<field name="doall" eval="True"/> |
|
||||
|
<field name="doall" eval="True" /> |
||||
</record> |
</record> |
||||
</data> |
</data> |
||||
</openerp> |
</openerp> |
@ -1,24 +1,28 @@ |
|||||
|
import logging |
||||
|
|
||||
import requests |
import requests |
||||
import simplejson |
import simplejson |
||||
|
|
||||
from openerp import models, api |
|
||||
|
from odoo import api, models |
||||
|
|
||||
import logging |
|
||||
_logger = logging.getLogger(__name__) |
_logger = logging.getLogger(__name__) |
||||
|
|
||||
|
|
||||
class IrConfigParameter(models.Model): |
class IrConfigParameter(models.Model): |
||||
_inherit = ['ir.config_parameter'] |
|
||||
|
_inherit = ["ir.config_parameter"] |
||||
|
|
||||
@api.model |
@api.model |
||||
def mailgun_verify(self): |
def mailgun_verify(self): |
||||
verified = self.sudo().get_param('mailgun.verified') |
|
||||
|
verified = self.sudo().get_param("mailgun.verified") |
||||
if verified: |
if verified: |
||||
return |
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: |
if api_key and mail_domain: |
||||
url = "https://api.mailgun.net/v3/domains/%s/verify" % mail_domain |
url = "https://api.mailgun.net/v3/domains/%s/verify" % mail_domain |
||||
res = requests.put(url, auth=("api", api_key)) |
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__) |
_logger = logging.getLogger(__name__) |
||||
|
|
||||
|
|
||||
class MailThread(models.AbstractModel): |
class MailThread(models.AbstractModel): |
||||
_inherit = 'mail.thread' |
|
||||
|
_inherit = "mail.thread" |
||||
|
|
||||
@api.model |
@api.model |
||||
def mailgun_fetch_message(self, message_url): |
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": "13.0.1.0.0", |
||||
|
"author": "IT-Projects LLC, Ivan Yelizariev", |
||||
|
"license": "LGPL-3", |
||||
"price": 35.00, |
"price": 35.00, |
||||
"currency": "EUR", |
"currency": "EUR", |
||||
'category': 'Discuss', |
|
||||
|
"category": "Discuss", |
||||
"support": "apps@it-projects.info", |
"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,17 +1,19 @@ |
|||||
from openerp import api |
|
||||
from openerp import models |
|
||||
|
from odoo import models |
||||
|
|
||||
|
|
||||
class Partner(models.Model): |
class Partner(models.Model): |
||||
_inherit = 'res.partner' |
|
||||
|
_inherit = "res.partner" |
||||
|
|
||||
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) |
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: |
for vals in res: |
||||
partner = self.browse(vals['id']) |
|
||||
|
partner = self.browse(vals["id"]) |
||||
if not partner.is_company: |
if not partner.is_company: |
||||
continue |
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 |
return res |
@ -1,3 +1,3 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
|
<?xml version="1.0" encoding="utf-8" ?> |
||||
<openerp><data> |
<openerp><data> |
||||
</data></openerp> |
</data></openerp> |
@ -1,16 +1,21 @@ |
|||||
|
|
||||
from openerp import models, fields, api |
|
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
class ResPartner(models.Model): |
class ResPartner(models.Model): |
||||
_inherit = 'res.partner' |
|
||||
|
_inherit = "res.partner" |
||||
mails_to = fields.Integer(compute="_compute_mails_to") |
mails_to = fields.Integer(compute="_compute_mails_to") |
||||
mails_from = fields.Integer(compute="_compute_mails_from") |
mails_from = fields.Integer(compute="_compute_mails_from") |
||||
|
|
||||
def _compute_mails_to(self): |
def _compute_mails_to(self): |
||||
for r in 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)]) |
||||
|
) |
||||
|
|
||||
def _compute_mails_from(self): |
def _compute_mails_from(self): |
||||
for r in 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; |
var _t = Core._t; |
||||
|
|
||||
Tour.register({ |
Tour.register({ |
||||
id: 'mails_count_tour', |
|
||||
|
id: "mails_count_tour", |
||||
name: _t("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: [ |
steps: [ |
||||
{ |
{ |
||||
title: _t("Mails count tutorial"), |
title: _t("Mails count tutorial"), |
||||
content: _t("Let's see how mails count work."), |
content: _t("Let's see how mails count work."), |
||||
popover: { next: _t("Start Tutorial"), end: _t("Skip") }, |
|
||||
|
popover: {next: _t("Start Tutorial"), end: _t("Skip")}, |
||||
}, |
}, |
||||
{ |
{ |
||||
title: _t("New fields"), |
title: _t("New fields"), |
||||
content: _t("Here is new fields with mails counters. Press one of it."), |
content: _t("Here is new fields with mails counters. Press one of it."), |
||||
element: '.mails_to', |
|
||||
waitFor: '.mails_to:visible', |
|
||||
|
element: ".mails_to", |
||||
|
waitFor: ".mails_to:visible", |
||||
}, |
}, |
||||
{ |
{ |
||||
title: _t("Done"), |
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")}, |
popover: {next: _t("Close Tutorial")}, |
||||
}, |
}, |
||||
] |
|
||||
|
], |
||||
}); |
}); |
||||
|
|
||||
}); |
}); |
@ -1,3 +1,3 @@ |
|||||
|
|
||||
from . import test_mail |
from . import test_mail |
||||
|
|
||||
# from . import test_phantom |
# from . import test_phantom |
@ -1,33 +1,62 @@ |
|||||
|
|
||||
from openerp.tests.common import TransactionCase |
|
||||
|
from odoo.tests.common import TransactionCase |
||||
|
|
||||
|
|
||||
class TestMessageCount(TransactionCase): |
class TestMessageCount(TransactionCase): |
||||
post_install = True |
post_install = True |
||||
|
|
||||
def test_count(self): |
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'] |
|
||||
compose = mail_compose.with_context( |
|
||||
|
new_partner1 = ( |
||||
|
self.env["res.partner"] |
||||
|
.sudo() |
||||
|
.create( |
||||
{ |
{ |
||||
'default_composition_mode': 'comment', |
|
||||
}).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( |
||||
{ |
{ |
||||
'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() |
compose.send_mail() |
||||
self.assertEqual(new_partner1.mails_to, 0) |
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) |
self.assertEqual(new_partner2.mails_from, 0) |
||||
compose.send_mail() |
compose.send_mail() |
||||
self.assertEqual(new_partner1.mails_to, 0) |
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) |
self.assertEqual(new_partner2.mails_from, 0) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue