Fix bug in read() operation of ir.model.field that didn't allow the function to receive a single id.
issue2336 review204001
This commit is contained in:
1 parent
d6e9bb5103
commit
e4679b22f2
1 file changed
+6
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user