diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py
index c1a12700eabf2eb7df7ed221665ca231ddfef7c6..300390e71b524c15a290a979bb0a95bc25debe20 100644
--- a/addons/mail/models/mail_message.py
+++ b/addons/mail/models/mail_message.py
@@ -1221,7 +1221,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 and issubclass(self.pool[model], self.pool['mail.thread']):
                 self.env[model].invalidate_cache(fnames=[
                     'message_ids',
                     'message_unread',