[19.0][MIG] mail_gateway: Migration to 19.0 - #202
Open
DucTruongKomit wants to merge 385 commits into
Open
Conversation
DucTruongKomit
force-pushed
the
19.0-mig-mail_gateway
branch
from
June 1, 2026 07:15
1be4c70 to
92a3b09
Compare
Member
|
Thanks for the move. I'm afraid you have lost the commit history. You should do a similar method than the migration one, but adding an extra remote for OCA/social. |
DucTruongKomit
force-pushed
the
19.0-mig-mail_gateway
branch
14 times, most recently
from
June 1, 2026 11:17
5e50ef4 to
7c9d8cc
Compare
Author
yes, I did. |
Member
|
Can you check CIs? |
DucTruongKomit
force-pushed
the
19.0-mig-mail_gateway
branch
3 times, most recently
from
June 2, 2026 01:31
0ec67ff to
a649485
Compare
DucTruongKomit
marked this pull request as draft
June 2, 2026 04:01
DucTruongKomit
force-pushed
the
19.0-mig-mail_gateway
branch
3 times, most recently
from
June 5, 2026 09:30
56e4d37 to
6e924d8
Compare
huan-tq
approved these changes
Jun 5, 2026
huan-tq
left a comment
There was a problem hiding this comment.
Functional Testing:
- The Menus introduced by this module are available.
- The Gateway buttons are available throughout the system.
- This is a base module intended to be extended by other
mail_gatewaymodules.
LGTM.
DucTruongKomit
force-pushed
the
19.0-mig-mail_gateway
branch
2 times, most recently
from
June 12, 2026 10:05
8706f65 to
e169248
Compare
Before this patch, the module was designed after the [deprecated Mailgun webhooks][3]. However Mailgun had the [events API][2] which was quite different. Modern Mailgun has deprecated those webhooks and instead uses new ones that include the same payload as the events API, so you can reuse code. However, this was incorrectly reusing the code inversely: trying to process the events API through the same code prepared for the deprecated webhooks. Besides, both `failed` and `rejected` mailgun events were mapped to `error` state, but that was also wrong because [`mail_tracking` doesn't have an `error` state][1]. So the logic of the whole module is changed, adapting it to process the events API payload, both through controllers (prepared for the new webhooks) and manual updates that directly call the events API. Also, `rejected` is now translated into `reject`, and `failed` is translated into `hard_bounce` or `soft_bounce` depending on the severity, as specified by [mailgun docs][2]. Also, `bounced` and `dropped` mailgun states are removed because they don't exist, and instead `failed` and `rejected` properly get their metadata. Of course, to know the severity, now the method to obtain that info must change, it' can't be a simple dict anymore. Added more parameters because for example modern Mailgun uses different keys for signing payload than for accessing the API. As there are so many parameters, configuration is now possible through `res.config.settings`. Go there to autoregister webhooks too. Since the new webhooks are completely incompatible with the old supposedly-abstract webhooks controllers (that were never really that abstract), support for old webhooks is removed, and it will be removed in the future from `mail_tracking` directly. There is a migration script that attempts to unregister old webhooks and register new ones automatically. [1]: https://github.com/OCA/social/blob/f73de421e28a43d018176f61725a3a59665f715d/mail_tracking/models/mail_tracking_event.py#L31-L42 [2]: https://documentation.mailgun.com/en/latest/api-events.html#event-types [3]: https://documentation.mailgun.com/en/latest/api-webhooks-deprecated.html
Mass mailing are tracked from mail.trace as the don't store a message in the db. In order to gather the message_id and be able to do manual checks to mailgun, that's the table where we should get the message id. TT40816
Since odoo/odoo@9a47101 bouncing the emails through the mailgun controller causes a singleton error when the anonymous user tries to record the bounce message. TT44585
Currently translated at 100.0% (60 of 60 strings) Translation: social-15.0/social-15.0-mail_tracking_mailgun Translate-URL: https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_tracking_mailgun/es/
- Fix tests - Fix warnings - Improve code - Get rid of superfluous stuff - Remove auto-validation. It couldn't be working as it was and it would drag performance on contacts creation/write if active. TT44207
Currently translated at 100.0% (58 of 58 strings) Translation: social-16.0/social-16.0-mail_tracking_mailgun Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_tracking_mailgun/it/
Currently translated at 37.9% (22 of 58 strings) Translation: social-16.0/social-16.0-mail_tracking_mailgun Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_tracking_mailgun/fr/
When we use the same Mailgun domain for other services, the email events for those services we'll be pushed to the Odoo controller as well. We want to discard them as they're useless to us. Aside from that, in the case a wrong db is called to the controller, we better logging the failed request is going to be more useful than raising an error.
Correct link message on the chatter, using also the provided native method instead of building it manually.
WARNING prod py.warnings: /opt/odoo/auto/addons/mail_tracking_mailgun/controllers/main.py:28: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC). WARNING prod py.warnings: /opt/odoo/auto/addons/mail_tracking_mailgun/models/mail_tracking_email.py:106: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
DucTruongKomit
force-pushed
the
19.0-mig-mail_gateway
branch
from
July 31, 2026 11:08
41c6b42 to
e36d783
Compare
Author
|
@hieulucky111 @Quan-nhm @Willysan2020 I updated the code, thank you |
DucTruongKomit
force-pushed
the
19.0-mig-mail_gateway
branch
from
July 31, 2026 11:24
9eaba56 to
cf4ea59
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[MIG] mail_gateway: Migration to 19.0