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

addons/mail/mail_message.py
""" Compute if the message is unread by the current user. """
        res = dict((id, False) for id in ids)
        partner_id = self.pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context).partner_id.id
        notif_obj = self.pool.get('mail.notification')
        notif_ids = notif_obj.search(cr, uid, [
            ('partner_id', 'in', [partner_id]),
            ('message_id', 'in', ids),
            ('is_read', '=', False),
        ], context=context)
        for notif in notif_obj.browse(cr, uid, notif_ids, context=context):
            res[notif.message_id.id] = True
        return res
    def _search_to_read(self, cr, uid, obj, name, domain, context=None):
        """ Search for messages to read by the current user. Condition is
            inversed because we search unread message on a is_read column. """
        return ['&', ('notification_ids.partner_id.user_ids', 'in', [uid]), ('notification_ids.is_read', '=', not domain[0][2])]
    def _get_starred(self, cr, uid, ids, name, arg, context=None):
        """ Compute if the message is unread by the current user. """
        res = dict((id, False) for id in ids)
        partner_id = self.pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context).partner_id.id
        notif_obj = self.pool.get('mail.notification')
        notif_ids = notif_obj.search(cr, uid, [
            ('partner_id', 'in', [partner_id]),
            ('message_id', 'in', ids),
            ('starred', '=', True),
        ], context=context)
        for notif in notif_obj.browse(cr, uid, notif_ids, context=context):
            res[notif.message_id.id] = True
        return res
    def _search_starred(self, cr, uid, obj, name, domain, context=None):