From 73db32a17fd9f8d24f307f8fb0cb95fd64266fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Wed, 5 Jul 2023 14:55:23 +0000 Subject: [PATCH] [FIX] mail: send message on archived chatter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up of https://github.com/odoo/odoo/pull/120002 Commit above made a a structural change of code that should not have changed the functional behaviour of chatter. In consideration of reducing query count footprint, it replaced a `browse().exists()` by `search()`, as `exists()` always perform a query whereas `search()` may rely on cache and skip a query. However, `search()` filters archived records, so this change unintentionally removed the possibility to send messages on archived chatter. Also the performance of `search()` and `browse().exists()` are pretty much the same, so the premise of changing it to `search()` seems wrong. This commit reverts this part so that this is the exact same behaviour as before. closes odoo/odoo#127518 X-original-commit: 43227ad2eaaeba3f6e3e6fae8b84728e0c33c59a Signed-off-by: Alexandre Kühn (aku) --- addons/mail/models/mail_thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 7eefd0091e5..d7e4faddfb8 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -457,7 +457,7 @@ class MailThread(models.AbstractModel): @api.model def _get_from_request_or_raise(self, request, thread_id): - return self.search([("id", "=", thread_id)]) + return self.browse(thread_id).exists() # ------------------------------------------------------------ # FIELDS HELPERS