Impacted versions:

8.0

Steps to reproduce:

To reproduce this one, you have to configure outgoing and incoming server and mail aliases

see https://youtu.be/-HzDGh9C9Jc

Current behavior:

If you add a user which has no acces on a object (purchase.order in this case) as follower on a record of this object **AFTER someone has responded by email on this record**, and if you send an message on this record, an exception is raised at the connection of the user added as a follower.

Expected behavior:

No exceptions should be raised at the connection of the user added as a follower.

Video/Screenshot link (optional):

https://youtu.be/-HzDGh9C9Jc

context=context, count=False, access_rights_uid=access_rights_uid)
        if not ids and count:
            return 0
        elif not ids:
            return ids
        pid = self.pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context).partner_id.id
        author_ids, partner_ids, allowed_ids = set([]), set([]), set([])
        model_ids = {}
        
        super(mail_message, self).check_access_rights(cr, access_rights_uid or uid, 'read')
        cr.execute("""SELECT DISTINCT m.id, m.model, m.res_id, m.author_id, n.partner_id
            FROM "%s" m LEFT JOIN "mail_notification" n
            ON n.message_id=m.id AND n.partner_id = (%%s)
            WHERE m.id = ANY (%%s)""" % self._table, (pid, ids,))
        for id, rmod, rid, author_id, partner_id in cr.fetchall():
            if author_id == pid:
                author_ids.add(id)
            elif partner_id == pid:
                partner_ids.add(id)
            elif rmod and rid:
                model_ids.setdefault(rmod, {}).setdefault(rid, set()).add(id)
        allowed_ids = self._find_allowed_doc_ids(cr, uid, model_ids, context=context)
        final_ids = author_ids | partner_ids | allowed_ids
        if count:
            return len(final_ids)
        else:
            
            id_list = [id for id in ids if id in final_ids]
            return id_list
    def check_access_rule(self, cr, uid, ids, operation, context=None):