'Verify the returned rows after applying record rules matches the
length of ``self``, and raise an appropriate exception if it does not.'

@api.multi
def _check_record_rules_result_count(self, result_ids, operation):

    (ids, result_ids) = (set(self.ids), set(result_ids))
    missing_ids = (ids - result_ids)
    if missing_ids:
        self._cr.execute(('SELECT    id    FROM    %s    WHERE    id    IN    %%s' % self._table), (tuple(missing_ids),))
        forbidden_ids = [x[0] for x in self._cr.fetchall()]
        if forbidden_ids:
            if (self._uid == SUPERUSER_ID):
                return
            _logger.info('Access    Denied    by    record    rules    for    operation:    %s    on    record    ids:    %r,    uid:    %s,    model:    %s', operation, forbidden_ids, self._uid, self._name)
            raise AccessError((_('The    requested    operation    cannot    be    completed    due    to    security    restrictions.    Please    contact    your    system    administrator.\n\n(Document    type:    %s,    Operation:    %s)') % (self._description, operation)))
        else:
            if (operation in ('read', 'unlink')):
                return
            _logger.info('Failed    operation    on    deleted    record(s):    %s,    uid:    %s,    model:    %s', operation, self._uid, self._name)
            raise MissingError(((_('Missing    document(s)') + ':') + _('One    of    the    documents    you    are    trying    to    access    has    been    deleted,    please    try    again    after    refreshing.')))
