[19.0][MIG] mail_gateway: Migration to 19.0#202
Conversation
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.
…ging thread Before these changes, the messages sent using the email thread were not being delivered. After making these changes, since the gateway_notifications key is empty, the super is called and the process continues normally.
Signed-off-by pedrobaeza
5e50ef4 to
7c9d8cc
Compare
yes, I did. |
|
Can you check CIs? |
0ec67ff to
a649485
Compare
56e4d37 to
6e924d8
Compare
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.
ec66121 to
1bcd4b7
Compare
10c130b to
e9d024f
Compare
e9d024f to
33a1649
Compare
It's ok now. |
| return res | ||
|
|
||
| @api.model | ||
| @tools.ormcache() |
There was a problem hiding this comment.
should add state and gateway_type
| def _get_webhook_url(self): | ||
| return "{}/gateway/{}/{}/update".format( | ||
| self.webhook_url | ||
| or self.env["ir.config_parameter"].get_param("web.base.url"), |
| ).bus_send() | ||
| return result | ||
|
|
||
| def _get_allowed_message_post_params(self): |
There was a problem hiding this comment.
function is changed in v19 => _get_allowed_message_params
There was a problem hiding this comment.
def _get_allowed_message_params(self):
return super()._get_allowed_message_params() | {"gateway_notifications"}| return result | ||
| def _to_store(self, store: Store, fields): | ||
| res = super()._to_store(store, fields) | ||
| for record in self: |
There was a problem hiding this comment.
add filter self.filtered("gateway_id")
| }, | ||
| "gateway_name": record.gateway_id.name, | ||
| "gateway_id": record.gateway_id.id, | ||
| "gateway_name": record.name, |
There was a problem hiding this comment.
replace by "gateway": record.gateway_id._gateway_info(),
| from odoo.addons.mail.tools.discuss import Store | ||
|
|
||
|
|
||
| class MailChannel(models.Model): |
| </record> | ||
| <record model="res.groups" id="gateway_user"> | ||
| <field name="name">User</field> | ||
| <field name="category_id" ref="module_category_gateway" /> |
| @api.depends("notification_ids", "gateway_message_ids") | ||
| def _compute_gateway_channel_ids(self): | ||
| for record in self: | ||
| if self.env.user.has_group("mail_gateway.gateway_user"): |
| ] | ||
|
|
||
| def _send_to_gateway_thread(self, gateway_channel_id): | ||
| chat_id = gateway_channel_id.gateway_id._get_channel_id( |
There was a problem hiding this comment.
if not chat_id => mail.gateway.abstract._get_channel(..., force_create=True)
|
/ocabot migration mail_gateway Please incorporate #1839 |
| follower_partners = ( | ||
| self.env["mail.followers"] | ||
| .sudo() | ||
| .search([("res_id", "=", record.id), ("res_model", "=", record._name)]) |
There was a problem hiding this comment.
Should we use search_fetch for this ?
|
Re the earlier comment about def _get_allowed_message_post_params(self):
result = super()._get_allowed_message_post_params()
result.add("gateway_notifications")
return resultVerified against an installed 19.0 core ( Suggested fix: def _get_allowed_message_params(self):
result = super()._get_allowed_message_params()
result.add("gateway_notifications")
return result |
[MIG] mail_gateway: Migration to 19.0