From 9e83fed2509dbe4113abb42237dcaabe17fe78f7 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 24 Sep 2008 05:21:35 +0200 Subject: [PATCH] If the ids is an int or a long, convert it to array, to avoid an error from the orm bzr revid: stephane@tinyerp.com-20080924032135-q52ns1968r88mdxt --- bin/osv/orm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 5bc44b4fd3d..f8defece530 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1113,6 +1113,8 @@ class orm_memory(orm_template): fields_to_read = self._columns.keys() result = [] if self.datas: + if isinstance(ids, (int, long)): + ids = [ids] for id in ids: r = {'id': id} for f in fields_to_read: @@ -1128,6 +1130,8 @@ class orm_memory(orm_template): res2 = self._columns[f].get_memory(cr, self, ids, f, user, context=context, values=result) for record in result: record[f] = res2[record['id']] + if isinstance(ids, (int, long)): + return result[0] return result def write(self, cr, user, ids, vals, context=None):