Use next to get first record instead of index

This allows to use set with ModelStorage.save.

issue6633
review40521002
This commit is contained in:
Cédric Krier committed 2017-07-19 19:57:30 +02:00
1 parent 6e92c8e3ba
commit 79fb0bcb7d
1 file changed
+4 -3
+4 -3
View File
@@ -1457,9 +1457,10 @@ class ModelStorage(Model):
save_values = {}
to_create = []
to_write = []
transaction = records[0]._transaction
user = records[0]._user
context = records[0]._context
first = next(iter(records))
transaction = first._transaction
user = first._user
context = first._context
for record in records:
if (record._transaction != transaction
or user != record._user