'Check access rights of operation ``mode`` on ``self`` for the
current user. Raise an AccessError in case conditions are not met.'

@api.multi
def check(self, mode):

    if self.env.user._is_admin():
        return
    trans_ids = []
    model_ids = defaultdict(list)
    model_fields = defaultdict(list)
    for trans in self:
        if (trans.type == 'model'):
            (mname, fname) = trans.name.split(',')
            model_ids[mname].append(trans.res_id)
            model_fields[mname].append(fname)
        else:
            trans_ids.append(trans.id)
    if trans_ids:
        records = self.browse(trans_ids)
        records.check_access_rights(mode)
        records.check_access_rule(mode)
    fmode = ('read' if (mode == 'read') else 'write')
    for (mname, ids) in model_ids.iteritems():
        records = self.env[mname].browse(ids)
        records.check_access_rights(fmode)
        records.check_field_access_rights(fmode, model_fields[mname])
        records.check_access_rule(fmode)
