From e4679b22f28de2b9362b424a142d2b0f33eac4f7 Mon Sep 17 00:00:00 2001 From: Albert Cervera i Areny Date: Sat, 24 Dec 2011 15:35:01 +0100 Subject: [PATCH] Fix bug in read() operation of ir.model.field that didn't allow the function to receive a single id. issue2336 review204001 --- trytond/ir/model.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/trytond/ir/model.py b/trytond/ir/model.py index 6ed829fc0a..c20259feb3 100644 --- a/trytond/ir/model.py +++ b/trytond/ir/model.py @@ -137,6 +137,10 @@ class ModelField(ModelSQL, ModelView): fields_names.append('name') to_delete.append('name') + int_id = False + if isinstance(ids, (int, long)): + int_id = True + ids = [ids] res = super(ModelField, self).read(ids, fields_names=fields_names) if (Transaction().context.get('language') @@ -189,6 +193,8 @@ class ModelField(ModelSQL, ModelView): for rec in res: for field in to_delete: del rec[field] + if int_id: + res = res[0] return res ModelField()