[REF] Use the collections.defaultdict object instead of an ugly code
bzr revid: stephane@openerp.com-20100611155317-jfer5wyiuso533se
This commit is contained in:
parent
c0494be7e9
commit
a315da754b
|
@ -31,6 +31,7 @@
|
|||
# required
|
||||
# size
|
||||
#
|
||||
from collections import defaultdict
|
||||
import string
|
||||
import netsvc
|
||||
import sys
|
||||
|
@ -430,9 +431,9 @@ class one2many(_column):
|
|||
context.update(self._context)
|
||||
if not values:
|
||||
values = {}
|
||||
res = {}
|
||||
for id in ids:
|
||||
res[id] = []
|
||||
|
||||
res = defaultdict(list)
|
||||
|
||||
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'):
|
||||
res[r[self._fields_id]].append(r['id'])
|
||||
|
|
Loading…
Reference in New Issue