Add patch for issue4720

This commit is contained in:
Sergi Almacellas Abellana 2015-04-28 09:01:40 +02:00
parent d2c692548c
commit 1f21f42195
2 changed files with 30 additions and 0 deletions

29
issue9231002_20001.diff Normal file
View file

@ -0,0 +1,29 @@
# HG changeset patch
# User Sergi Almacellas Abellana <sergi@koolpi.com>
Fix copy of translated fields when records aren't read in order
issue4720
review9231002
Index: trytond/trytond/model/modelstorage.py
===================================================================
--- a/trytond/trytond/model/modelstorage.py
+++ b/trytond/trytond/model/modelstorage.py
@@ -301,11 +301,12 @@
if (not isinstance(f, fields.Function)
or isinstance(f, fields.Property))]
ids = map(int, records)
- datas = cls.read(ids, fields_names=fields_names)
+ datas = dict((d['id'], d) for d in cls.read(ids,
+ fields_names=fields_names))
field_defs = cls.fields_get(fields_names=fields_names)
to_create = []
- for data in datas:
- data = convert_data(field_defs, data)
+ for id in ids:
+ data = convert_data(field_defs, datas[id])
to_create.append(data)
new_records = cls.create(to_create)
new_ids = dict(izip(ids, map(int, new_records)))

1
series
View file

@ -51,3 +51,4 @@ issue6241002_1.diff
top.diff
issue15211002-sale-confirmed-to-done.diff
issue9231002_20001.diff