[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 <pta@odoo.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Archana Vaghasiya
2023-03-27 09:39:53 +02:00
parent 0c9c20d747
commit 13554dd655
+1 -1
View File
@@ -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):