diff --git a/bin/osv/fields.py b/bin/osv/fields.py index 0edd39cdf5e..3800775b30c 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -31,7 +31,6 @@ # required # size # -from collections import defaultdict import datetime as DT import string import netsvc @@ -453,12 +452,14 @@ class one2many(_column): if not values: values = {} - res = defaultdict(list) + res = {} + for id in ids: + res[id] = [] ids2 = obj.pool.get(self._obj).search(cr, user, self._domain + [(self._fields_id, 'in', ids)], limit=self._limit, context=context) for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2, [self._fields_id], context=context, load='_classic_write'): -# if r[self._fields_id] in res.values(): - res[r[self._fields_id]].append(r['id']) + if r[self._fields_id] in res.values(): + res[r[self._fields_id]].append(r['id']) return res def set(self, cr, obj, id, field, values, user=None, context=None):