Use read instead of browse in Many2Many for performence

This commit is contained in:
Cédric Krier
2009-04-02 00:37:05 +02:00
parent e66da8ad87
commit a50899cb56
+3 -3
View File
@@ -67,9 +67,9 @@ class Many2Many(Field):
(self.target + '.id', '!=', False),
], order=self.order, context=context)
for relation in relation_obj.browse(cursor, user, relation_ids,
context=context):
res[relation[self.origin].id].append(relation[self.target].id)
for relation in relation_obj.read(cursor, user, relation_ids,
[self.origin, self.target], context=context):
res[relation[self.origin]].append(relation[self.target])
return res
def set(self, cursor, user, record_id, model, name, values, context=None):