'Check that relation fields return records, recordsets or nulls.'

@mute_logger('odoo.models')
def test_06_fields(self):

    user = self.env.user
    self.assertIsRecord(user, 'res.users')
    self.assertIsRecord(user.partner_id, 'res.partner')
    self.assertIsRecordset(user.groups_id, 'res.groups')
    partners = self.env['res.partner'].search([])
    for (name, field) in partners._fields.iteritems():
        if (field.type == 'many2one'):
            for p in partners:
                self.assertIsRecord(p[name], field.comodel_name)
        elif (field.type == 'reference'):
            for p in partners:
                if p[name]:
                    self.assertIsRecord(p[name], field.comodel_name)
        elif (field.type in ('one2many', 'many2many')):
            for p in partners:
                self.assertIsRecordset(p[name], field.comodel_name)
