From 13554dd655ccd7e719a694d6cc7f944ea660b237 Mon Sep 17 00:00:00 2001 From: Archana Vaghasiya Date: Fri, 17 Mar 2023 11:07:36 +0000 Subject: [PATCH] [FIX] mail: invalidate the cache of the documents If applied, this commit will solve the keyError for _invalidate_documents. Before this commit: ============================================ KeyError 'rating' or 'False' occurs when a user tries to send a message and _invalidate_documents() takes the parameter model equal to 'rating' or 'False'. but the model 'rating' is not available in the database and It will be accessed by the self.pool[model]. After this commit: ============================================ Solved the issue when the model 'rating' is not available or the model is 'False' while sending a message. sentry - 3956327451 closes odoo/odoo#116302 X-original-commit: 5becbca6531d5829bee262a5c1b64ae5e0917f8e Signed-off-by: Anh Thao PHAM Signed-off-by: Thibault Delavallee (tde) --- addons/mail/models/mail_message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index 5120e3fe624..1339f9fe5c9 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -1160,7 +1160,7 @@ class Message(models.Model): for record in self: model = model or record.model res_id = res_id or record.res_id - if issubclass(self.pool[model], self.pool['mail.thread']): + if model in self.pool and issubclass(self.pool[model], self.pool['mail.thread']): self.env[model].browse(res_id).invalidate_recordset(fnames) def _get_search_domain_share(self):