From 811cbb2ad49d2557ede97604c9cb6a42c60dc2aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 25 Jan 2017 23:30:23 +0100 Subject: [PATCH] Fix test to translate read field The test was using the field name instead of the field instance. It is better to keep the usual convention of using fname for name and field for the instance. issue6208 review33011002 --- trytond/model/modelsql.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py index 9b7e3b7352..07da68d40c 100644 --- a/trytond/model/modelsql.py +++ b/trytond/model/modelsql.py @@ -725,15 +725,17 @@ class ModelSQL(ModelStorage): for column in columns: # Split the output name to remove SQLite type detection - field = column.output_name.split()[0] - if field == '_timestamp': + fname = column.output_name.split()[0] + if fname == '_timestamp': continue - if (getattr(cls._fields[field], 'translate', False) + field = cls._fields[fname] + if (getattr(field, 'translate', False) and not hasattr(field, 'get')): - translations = Translation.get_ids(cls.__name__ + ',' + field, - 'model', Transaction().language, ids) + translations = Translation.get_ids( + cls.__name__ + ',' + fname, 'model', + Transaction().language, ids) for row in result: - row[field] = translations.get(row['id']) or row[field] + row[fname] = translations.get(row['id']) or row[fname] # all fields for which there is a get attribute getter_fields = [f for f in