From 1f21f42195a7cf26595bb939715db64f8866ccf1 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Tue, 28 Apr 2015 09:01:40 +0200 Subject: [PATCH] Add patch for issue4720 --- issue9231002_20001.diff | 29 +++++++++++++++++++++++++++++ series | 1 + 2 files changed, 30 insertions(+) create mode 100644 issue9231002_20001.diff diff --git a/issue9231002_20001.diff b/issue9231002_20001.diff new file mode 100644 index 0000000..31f0c3e --- /dev/null +++ b/issue9231002_20001.diff @@ -0,0 +1,29 @@ +# HG changeset patch +# User Sergi Almacellas Abellana +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))) + diff --git a/series b/series index a8f557c..1c0a614 100644 --- a/series +++ b/series @@ -51,3 +51,4 @@ issue6241002_1.diff top.diff issue15211002-sale-confirmed-to-done.diff +issue9231002_20001.diff