Repository navigation
[20.0][MIG] mail_gateway: Migration to 20.0 - #314
Merged
Merged
Conversation
Member
|
/ocabot migration mail_gateway |
2 of 25 tasks
Member
|
include this comits 🙏 |
Author
|
Done @etobella |
CarlosRoca13
force-pushed
the
20.0-MIG-mail_gateway
branch
2 times, most recently
from
October 26, 2026 14:58
892eb44 to
bcb1bad
Compare
Contributor
|
Please include #324 |
Member
|
@carlos-lopez-tecnativa can you put up to date this PR including #353 and #324? |
Currently translated at 100.0% (85 of 85 strings) Translation: social-16.0/social-16.0-mail_gateway Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_gateway/it/
Other OCA modules extending the composer add m2m fields with fixed relations. To avoid a glue module we try for the moment to add those manually. TT51108
Currently translated at 81.2% (113 of 139 strings) Translation: social-16.0/social-16.0-mail_gateway Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_gateway/it/
Currently translated at 10.7% (15 of 139 strings) Translation: social-16.0/social-16.0-mail_gateway Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_gateway/es/
…ated to the current user - Use OdooBot for webhooks instead of the current user, following the same logic as Odoo. - Avoid automatically adding the current user as a member of a new gateway to prevent notifications for all messages. This is now an explicit configuration.
Odoo 18 renamed the Thread record field `lastInterestDateTime` to `lastInterestDt` (defined in mail/static/src/core/common/thread_model.js; used by the "chats" category sort in mail/static/src/core/public_web/discuss_app_category_model.js). The 17.0 patch was ported unchanged, so `compareDatetime()` compares `undefined` with `undefined` and silently falls back to `t2.id - t1.id`: gateway channels end up stacked by creation order instead of last activity. Use the 18.0 field name so the gateway category is sorted by last interest again, most recent first.
The patch on Store.one_id is applied at import time, so it is shared by every registry served by the process, while gateway_channel_ids only exists in the registries where mail_gateway is installed. A database without the module, served by a worker that already imported it, fails with an AttributeError inside session_info(), which leaves its whole backend unreachable. Check the registry the call actually runs against before reading the field.
Core only allows this if ["channel", "group"].includes(this.channel_type). See https://github.com/odoo/odoo/blob/5249e0b082cfff650e1dad36aade470cf25a1ad5/addons/mail/static/src/core/common/thread_model.js#L90
…ll a member Otherwise, bus notifications keep arriving after leaving the channel, and an AccessError is raised because the user is no longer a member.
…ateway_user security group The members in the gateway are used to set the default members for new channels. However, in day-to-day use, if new users are added to the mail_gateway.gateway_user group, they do not automatically become members of existing channels. With the native option to invite people, new users can join the channel. However, for security reasons, we limit this to users who belong to the mail_gateway.gateway_user group. Core has a feature that uses the group_public_id field to set a group that restricts which users can be invited. However, this only works when channel_type = 'channel'. See https://github.com/odoo/odoo/blob/5249e0b082cfff650e1dad36aade470cf25a1ad5/addons/mail/models/discuss/discuss_channel.py#L90
Store.one_id() builds the reference to a record rather than its content, and its docstring asks callers to avoid it. Sending the gateway channels from a res.partner._to_store() override instead, the way hr_holidays and im_livechat extend partner store data, removes the need for the registry guard added in #1913: a model override only exists in the registries where its module is installed. _thread_to_store() read the channels back from the follower references and passed them on as gateway_followers without ever adding the partners to the store, so it relates them with Store.many() now.
The conditions of the "New Partner" and "Open Contact" thread actions started an async searchRead and then re-rendered the owner. Conditions are evaluated on every render, so this re-rendered DiscussContent while it was still mounting and the Owl fiber never completed: Discuss showed no messages in any channel. The gateway partner and the single guest of the channel are now sent with the channel store data, and the conditions only read them. Fixes OCA#319 Assisted-by: Claude Opus 5.5
_to_store runs for every channel of the user on Discuss load: search res.partner.gateway.channel once for the whole recordset instead of once per gateway channel.
stateToUrl is not exported by @web/core/browser/router in 19.0 (only through the router object), so building the URL of a gateway message failed as soon as such a message was rendered. It went unnoticed while Discuss did not render any message.
…tions mail.gateway is readable only by administrators since 0fd2edc, so a gateway user that is not an administrator got an AccessError when the conversation was sent to the client (discuss.channel._to_store), when posting in it and when leaving it. Read the gateway with sudo there: only its id, name and type are used.
The mail.resend.message wizard no longer exists in 19.0, so the user only saw "Exception" when a gateway message failed. Send a short version of failure_reason with gateway notifications and show it in the message notification popover instead.
Gateway users without administration rights got an AccessError when sending a message with the 'Send with gateway' wizard, merging a guest into a contact or loading the models of the 'Link to thread' wizard, as mail.gateway is only readable by administrators.
("gateway") is a string, not a tuple, so 'not in' checked for a substring of 'gateway' instead of the gateway channel type.
carlos-lopez-tecnativa
force-pushed
the
20.0-MIG-mail_gateway
branch
from
November 18, 2026 18:13
bcb1bad to
6756e7e
Compare
Contributor
Done. Additionally, I found some access errors caused by OCA/social#1937, so I backported f8ec84d to earlier versions. |
carlos-lopez-tecnativa
approved these changes
Nov 18, 2026
carlos-lopez-tecnativa
left a comment
Contributor
There was a problem hiding this comment.
Tested with #320
pedrobaeza
approved these changes
Nov 20, 2026
pedrobaeza
left a comment
Member
There was a problem hiding this comment.
Code review
/ocabot merge nobump
Contributor
|
On my way to merge this fine PR! |
Contributor
|
Congratulations, your PR was merged at f8c70a4. Thanks a lot for contributing to OCA. ❤️ |
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.
cc @Tecnativa TT65068
ping @carlos-lopez-tecnativa @pedrobaeza