From cda6621fb8769f276abbc851f4dcca67dad96bce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Mon, 4 Sep 2023 16:39:22 +0200 Subject: [PATCH] [FIX] mail: set automatic email signature from correct company MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When sending an email from a multi-company environment, the automatic email signature is not corresponding to the company from which the email is sent. This is because the user context is not properly forwarded, in particular the `allowed_company_ids` key. The issue comes from the new rpc service not autmatically adding the user context to the request, whereas the legacy rpc service did. opw-3394780 closes odoo/odoo#133596 X-original-commit: 5d6a0257ccd7f0b0f9a05050151ba66f35aeea37 Signed-off-by: Alexandre Kühn (aku) Signed-off-by: Sébastien Theys (seb) --- addons/mail/static/src/core/common/thread_service.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/core/common/thread_service.js b/addons/mail/static/src/core/common/thread_service.js index 98ead0b0769..5be8b53d8c5 100644 --- a/addons/mail/static/src/core/common/thread_service.js +++ b/addons/mail/static/src/core/common/thread_service.js @@ -42,6 +42,7 @@ export class ThreadService { this.notificationService = services.notification; this.router = services.router; this.ui = services.ui; + this.user = services.user; this.messageService = services["mail.message"]; this.personaService = services["mail.persona"]; } @@ -814,7 +815,7 @@ export class ThreadService { thread, }); const tmpId = this.messageService.getNextTemporaryId(); - params.context = { ...params.context, temporary_id: tmpId }; + params.context = { ...this.user.context, ...params.context, temporary_id: tmpId }; if (parentId) { params.post_data.parent_id = parentId; } @@ -1088,6 +1089,7 @@ export const threadService = { "mail.message", "mail.persona", "ui", + "user", ], /** * @param {import("@web/env").OdooEnv} env