'Check the record cache prefetching'

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

    partners = self.env['res.partner'].search([], limit=models.PREFETCH_MAX)
    self.assertTrue((len(partners) > 1))
    self.assertItemsEqual(partners.ids, partners._prefetch['res.partner'])
    partner = next((p for p in partners))
    partner.country_id
    country_id_cache = self.env.cache[type(partners).country_id]
    self.assertItemsEqual(partners.ids, country_id_cache)
    country_ids = set((cid for cids in country_id_cache.itervalues() for cid in cids))
    self.assertTrue((len(country_ids) > 1))
    self.assertItemsEqual(country_ids, partners._prefetch['res.country'])
    country = next((p.country_id for p in partners if p.country_id))
    country.name
    name_cache = self.env.cache[type(country).name]
    self.assertItemsEqual(country_ids, name_cache)
