mirror of https://github.com/OCA/social.git
[MIG] mail_tracking_mailgun: Migration to 16.0
parent
8a65f7664a
commit
f68e28996b
|
@ -7,7 +7,7 @@ Mail tracking for Mailgun
|
||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! changes will be overwritten. !!
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
!! source digest: sha256:8f1f90f9d396cee0a417a6ad7820cf9eb0d9115c51ef82aaf19c13d84b2f2e4d
|
!! source digest: sha256:8920907240b8a1e7fceee196aa3c437a5c4ea4864588b43458c13b55d708ea36
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||||
|
@ -17,13 +17,13 @@ Mail tracking for Mailgun
|
||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
|
||||||
:target: https://github.com/OCA/social/tree/15.0/mail_tracking_mailgun
|
:target: https://github.com/OCA/social/tree/16.0/mail_tracking_mailgun
|
||||||
:alt: OCA/social
|
:alt: OCA/social
|
||||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
:target: https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_tracking_mailgun
|
:target: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_tracking_mailgun
|
||||||
:alt: Translate me on Weblate
|
:alt: Translate me on Weblate
|
||||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||||
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=15.0
|
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=16.0
|
||||||
:alt: Try me on Runboat
|
:alt: Try me on Runboat
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
@ -67,6 +67,10 @@ You can also config partner email autocheck with this system parameter:
|
||||||
|
|
||||||
- `mailgun.auto_check_partner_email`: Set it to True.
|
- `mailgun.auto_check_partner_email`: Set it to True.
|
||||||
|
|
||||||
|
You can also config timeout for mailgun with this system parameter:
|
||||||
|
|
||||||
|
- `mailgun.timeout`: Set it to a number of seconds.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
=====
|
=====
|
||||||
|
|
||||||
|
@ -102,7 +106,7 @@ Bug Tracker
|
||||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||||
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_tracking_mailgun%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_tracking_mailgun%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
Do not contact contributors directly about support or help with technical issues.
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
|
@ -149,6 +153,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.
|
promote its widespread use.
|
||||||
|
|
||||||
This module is part of the `OCA/social <https://github.com/OCA/social/tree/15.0/mail_tracking_mailgun>`_ project on GitHub.
|
This module is part of the `OCA/social <https://github.com/OCA/social/tree/16.0/mail_tracking_mailgun>`_ project on GitHub.
|
||||||
|
|
||||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{
|
{
|
||||||
"name": "Mail tracking for Mailgun",
|
"name": "Mail tracking for Mailgun",
|
||||||
"summary": "Mail tracking and Mailgun webhooks integration",
|
"summary": "Mail tracking and Mailgun webhooks integration",
|
||||||
"version": "15.0.1.1.1",
|
"version": "16.0.1.0.0",
|
||||||
"category": "Social Network",
|
"category": "Social Network",
|
||||||
"website": "https://github.com/OCA/social",
|
"website": "https://github.com/OCA/social",
|
||||||
"author": "Tecnativa, Odoo Community Association (OCA)",
|
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||||
|
|
|
@ -64,12 +64,12 @@ class MailTrackingController(main.MailTrackingController):
|
||||||
# See https://documentation.mailgun.com/en/latest/user_manual.html#routes
|
# See https://documentation.mailgun.com/en/latest/user_manual.html#routes
|
||||||
try:
|
try:
|
||||||
self._mail_tracking_mailgun_webhook_verify(
|
self._mail_tracking_mailgun_webhook_verify(
|
||||||
**request.jsonrequest["signature"]
|
**request.dispatcher.jsonrequest["signature"]
|
||||||
)
|
)
|
||||||
except ValidationError as error:
|
except ValidationError as error:
|
||||||
raise NotAcceptable from error
|
raise NotAcceptable from error
|
||||||
# Process event
|
# Process event
|
||||||
request.env["mail.tracking.email"].sudo()._mailgun_event_process(
|
request.env["mail.tracking.email"].sudo()._mailgun_event_process(
|
||||||
request.jsonrequest["event-data"],
|
request.dispatcher.jsonrequest["event-data"],
|
||||||
self._request_metadata(),
|
self._request_metadata(),
|
||||||
)
|
)
|
||||||
|
|
|
@ -217,6 +217,9 @@ class MailTrackingEmail(models.Model):
|
||||||
url,
|
url,
|
||||||
auth=("api", api_key),
|
auth=("api", api_key),
|
||||||
params=params,
|
params=params,
|
||||||
|
timeout=self.env["ir.config_parameter"]
|
||||||
|
.sudo()
|
||||||
|
.get_param("mailgun.timeout", 10),
|
||||||
)
|
)
|
||||||
if not res or res.status_code != 200:
|
if not res or res.status_code != 200:
|
||||||
raise UserError(_("Couldn't retrieve Mailgun information"))
|
raise UserError(_("Couldn't retrieve Mailgun information"))
|
||||||
|
|
|
@ -61,6 +61,9 @@ class ResPartner(models.Model):
|
||||||
urljoin(params.api_url, "/v3/address/validate"),
|
urljoin(params.api_url, "/v3/address/validate"),
|
||||||
auth=("api", params.validation_key),
|
auth=("api", params.validation_key),
|
||||||
params={"address": partner.email, "mailbox_verification": True},
|
params={"address": partner.email, "mailbox_verification": True},
|
||||||
|
timeout=self.env["ir.config_parameter"]
|
||||||
|
.sudo()
|
||||||
|
.get_param("mailgun.timeout", 10),
|
||||||
)
|
)
|
||||||
if (
|
if (
|
||||||
not res
|
not res
|
||||||
|
@ -136,6 +139,9 @@ class ResPartner(models.Model):
|
||||||
res = requests.get(
|
res = requests.get(
|
||||||
urljoin(api_url, "/v3/%s/bounces/%s" % (domain, partner.email)),
|
urljoin(api_url, "/v3/%s/bounces/%s" % (domain, partner.email)),
|
||||||
auth=("api", api_key),
|
auth=("api", api_key),
|
||||||
|
timeout=self.env["ir.config_parameter"]
|
||||||
|
.sudo()
|
||||||
|
.get_param("mailgun.timeout", 10),
|
||||||
)
|
)
|
||||||
if res.status_code == 200 and not partner.email_bounced:
|
if res.status_code == 200 and not partner.email_bounced:
|
||||||
partner.email_bounced = True
|
partner.email_bounced = True
|
||||||
|
@ -156,6 +162,9 @@ class ResPartner(models.Model):
|
||||||
urljoin(api_url, "/v3/%s/bounces" % domain),
|
urljoin(api_url, "/v3/%s/bounces" % domain),
|
||||||
auth=("api", api_key),
|
auth=("api", api_key),
|
||||||
data={"address": partner.email},
|
data={"address": partner.email},
|
||||||
|
timeout=self.env["ir.config_parameter"]
|
||||||
|
.sudo()
|
||||||
|
.get_param("mailgun.timeout", 10),
|
||||||
)
|
)
|
||||||
partner.email_bounced = res.status_code == 200 and not partner.email_bounced
|
partner.email_bounced = res.status_code == 200 and not partner.email_bounced
|
||||||
|
|
||||||
|
@ -172,6 +181,9 @@ class ResPartner(models.Model):
|
||||||
res = requests.delete(
|
res = requests.delete(
|
||||||
urljoin(api_url, "/v3/%s/bounces/%s" % (domain, partner.email)),
|
urljoin(api_url, "/v3/%s/bounces/%s" % (domain, partner.email)),
|
||||||
auth=("api", api_key),
|
auth=("api", api_key),
|
||||||
|
timeout=self.env["ir.config_parameter"]
|
||||||
|
.sudo()
|
||||||
|
.get_param("mailgun.timeout", 10),
|
||||||
)
|
)
|
||||||
if res.status_code in (200, 404) and partner.email_bounced:
|
if res.status_code in (200, 404) and partner.email_bounced:
|
||||||
partner.email_bounced = False
|
partner.email_bounced = False
|
||||||
|
|
|
@ -10,3 +10,7 @@ To configure this module, you need to:
|
||||||
You can also config partner email autocheck with this system parameter:
|
You can also config partner email autocheck with this system parameter:
|
||||||
|
|
||||||
- `mailgun.auto_check_partner_email`: Set it to True.
|
- `mailgun.auto_check_partner_email`: Set it to True.
|
||||||
|
|
||||||
|
You can also config timeout for mailgun with this system parameter:
|
||||||
|
|
||||||
|
- `mailgun.timeout`: Set it to a number of seconds.
|
||||||
|
|
|
@ -367,9 +367,9 @@ ul.auto-toc {
|
||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! changes will be overwritten. !!
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
!! source digest: sha256:8f1f90f9d396cee0a417a6ad7820cf9eb0d9115c51ef82aaf19c13d84b2f2e4d
|
!! source digest: sha256:8920907240b8a1e7fceee196aa3c437a5c4ea4864588b43458c13b55d708ea36
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/15.0/mail_tracking_mailgun"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_tracking_mailgun"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/16.0/mail_tracking_mailgun"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_tracking_mailgun"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||||
<p>This module integrates mail_tracking events with Mailgun webhooks.</p>
|
<p>This module integrates mail_tracking events with Mailgun webhooks.</p>
|
||||||
<p>Mailgun (<a class="reference external" href="https://www.mailgun.com/">https://www.mailgun.com/</a>) is a service that provides an e-mail
|
<p>Mailgun (<a class="reference external" href="https://www.mailgun.com/">https://www.mailgun.com/</a>) is a service that provides an e-mail
|
||||||
sending infrastructure through an SMTP server or via API. You can also
|
sending infrastructure through an SMTP server or via API. You can also
|
||||||
|
@ -419,6 +419,10 @@ you need to add <tt class="docutils literal">mail_tracking_mailgun</tt> addon to
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><cite>mailgun.auto_check_partner_email</cite>: Set it to True.</li>
|
<li><cite>mailgun.auto_check_partner_email</cite>: Set it to True.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<p>You can also config timeout for mailgun with this system parameter:</p>
|
||||||
|
<ul class="simple">
|
||||||
|
<li><cite>mailgun.timeout</cite>: Set it to a number of seconds.</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="usage">
|
<div class="section" id="usage">
|
||||||
<h1><a class="toc-backref" href="#toc-entry-3">Usage</a></h1>
|
<h1><a class="toc-backref" href="#toc-entry-3">Usage</a></h1>
|
||||||
|
@ -451,7 +455,7 @@ Mailgun in Odoo. However, it doesn’t come without its <a class="reference exte
|
||||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||||
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_tracking_mailgun%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_tracking_mailgun%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="credits">
|
<div class="section" id="credits">
|
||||||
|
@ -494,7 +498,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.</p>
|
promote its widespread use.</p>
|
||||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/15.0/mail_tracking_mailgun">OCA/social</a> project on GitHub.</p>
|
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/16.0/mail_tracking_mailgun">OCA/social</a> project on GitHub.</p>
|
||||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -82,6 +82,9 @@ class ResConfigSettings(models.TransientModel):
|
||||||
webhooks = requests.get(
|
webhooks = requests.get(
|
||||||
urljoin(params.api_url, "/v3/domains/%s/webhooks" % params.domain),
|
urljoin(params.api_url, "/v3/domains/%s/webhooks" % params.domain),
|
||||||
auth=("api", params.api_key),
|
auth=("api", params.api_key),
|
||||||
|
timeout=self.env["ir.config_parameter"]
|
||||||
|
.sudo()
|
||||||
|
.get_param("mailgun.timeout", 10),
|
||||||
)
|
)
|
||||||
webhooks.raise_for_status()
|
webhooks.raise_for_status()
|
||||||
for event, data in webhooks.json()["webhooks"].items():
|
for event, data in webhooks.json()["webhooks"].items():
|
||||||
|
@ -100,6 +103,9 @@ class ResConfigSettings(models.TransientModel):
|
||||||
"/v3/domains/%s/webhooks/%s" % (params.domain, event),
|
"/v3/domains/%s/webhooks/%s" % (params.domain, event),
|
||||||
),
|
),
|
||||||
auth=("api", params.api_key),
|
auth=("api", params.api_key),
|
||||||
|
timeout=self.env["ir.config_parameter"]
|
||||||
|
.sudo()
|
||||||
|
.get_param("mailgun.timeout", 10),
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
|
@ -116,6 +122,9 @@ class ResConfigSettings(models.TransientModel):
|
||||||
urljoin(params.api_url, "/v3/domains/%s/webhooks" % params.domain),
|
urljoin(params.api_url, "/v3/domains/%s/webhooks" % params.domain),
|
||||||
auth=("api", params.api_key),
|
auth=("api", params.api_key),
|
||||||
data={"id": event, "url": [odoo_webhook]},
|
data={"id": event, "url": [odoo_webhook]},
|
||||||
|
timeout=self.env["ir.config_parameter"]
|
||||||
|
.sudo()
|
||||||
|
.get_param("mailgun.timeout", 10),
|
||||||
)
|
)
|
||||||
# Assert correct registration
|
# Assert correct registration
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
Loading…
Reference in New Issue