[FIX] mail_gateway: Pass company in order to ensure that it is executed properly

pull/1444/head
Enric Tobella 2024-07-17 11:36:04 +02:00
parent 9471bd53df
commit 7c0e580e05
2 changed files with 3 additions and 1 deletions

View File

@ -32,6 +32,7 @@ class GatewayController(Controller):
return (
request.env["mail.gateway.%s" % usage]
.with_user(bot_data["webhook_user_id"])
.with_company(bot_data["company_id"])
._receive_get_update(bot_data, request, **kwargs)
)
bot_data = request.env["mail.gateway"]._get_gateway(

View File

@ -113,7 +113,7 @@ class MailGateway(models.Model):
@tools.ormcache()
def _get_gateway_map(self, state="integrated", gateway_type=False):
result = {}
for record in self.search(
for record in self.sudo().search(
[
("integrated_webhook_state", "=", state),
("gateway_type", "=", gateway_type),
@ -125,6 +125,7 @@ class MailGateway(models.Model):
def _get_gateway_data(self):
return {
"id": self.id,
"company_id": self.company_id.id,
"webhook_secret": self.webhook_secret,
"webhook_user_id": self.webhook_user_id.id,
}