diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py index 5ef3d15da91..ca572b91e32 100644 --- a/addons/calendar/calendar.py +++ b/addons/calendar/calendar.py @@ -1581,12 +1581,6 @@ class calendar_event(osv.Model): select = [ids] else: select = ids - - # FIXME: find a better way to not push virtual ids in the cache - # (leading to their prefetching and ultimately a type error when - # postgres tries to convert '14-3489274297' to an integer) - self.invalidate_cache(cr, uid, context=context) - select = map(lambda x: (x, calendar_id2real_id(x)), select) result = [] real_data = super(calendar_event, self).read(cr, uid, [real_id for calendar_id, real_id in select], fields=fields2, context=context, load=load) diff --git a/openerp/models.py b/openerp/models.py index 5e319a7ef20..d8d0dc2ad4a 100644 --- a/openerp/models.py +++ b/openerp/models.py @@ -3122,7 +3122,7 @@ class BaseModel(object): instance) for `self` in cache. """ # fetch the records of this model without field_name in their cache - records = self + records = self._in_cache_without(field) # by default, simply fetch field fnames = {field.name} @@ -3198,16 +3198,8 @@ class BaseModel(object): 'order': self._parent_order or self._order, } - empty = self.browse() - prefetch = set() - todo = set() - for field in (self._fields[name] for name in field_names): - prefetch.update(self._in_cache_without(field).ids) - todo.update(self.env.todo.get(field, empty).ids) - records = self.browse(prefetch - todo | set(self.ids)) - result = [] - for sub_ids in cr.split_for_in_conditions(records.ids): + for sub_ids in cr.split_for_in_conditions(self.ids): cr.execute(query, [tuple(sub_ids)] + rule_params) result.extend(cr.dictfetchall()) @@ -3280,9 +3272,9 @@ class BaseModel(object): # store failed values in cache for the records that could not be read fetched = self.browse(ids) - missing = records - fetched + missing = self - fetched if missing: - extras = fetched - records + extras = fetched - self if extras: raise AccessError( _("Database fetch misses ids ({}) and has extra ids ({}), may be caused by a type incoherence in a previous request").format(