From f5dd14e8ceec8402d4c3f587d59e756854228ac0 Mon Sep 17 00:00:00 2001 From: Maryam Kia Date: Mon, 19 Jun 2023 09:01:54 +0000 Subject: [PATCH] [FIX] mail: message sent twice because of the wrong tempId MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit task #3356870 Before this fix, at the first time of sending message in a chat, the tempId of the message in the chatter, crashes the getting lastMessageId and the first tempId in the chat becomes NaN. closes odoo/odoo#125424 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/core/web/thread_service_patch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/static/src/core/web/thread_service_patch.js b/addons/mail/static/src/core/web/thread_service_patch.js index cf3564dba94..746b9ad921b 100644 --- a/addons/mail/static/src/core/web/thread_service_patch.js +++ b/addons/mail/static/src/core/web/thread_service_patch.js @@ -106,7 +106,7 @@ patch(ThreadService.prototype, "mail/core/web", { type: "chatter", }); if (resId === false) { - const tmpId = `virtual${this.nextId++}`; + const tmpId = this.messageService.getNextTemporaryId(); const tmpData = { id: tmpId, author: { id: this.store.self.id },