[FIX] mail: send message on archived chatter

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) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2023-07-06 00:27:43 +02:00
parent de0a473d55
commit 73db32a17f
+1 -1
View File
@@ -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