From fff40de35d2be86b30e254d08b253999299422ee Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 2 Feb 2010 17:40:13 +0100 Subject: [PATCH] [FIX] orm: bug when browsing _inherits object bzr revid: chs@tinyerp.com-20100202164013-7o85hcmmhqcg5fvz --- bin/osv/orm.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index ce3229c5e36..01364b669b1 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -214,7 +214,16 @@ class browse_record(object): else: ids2 = data[n] if ids2: - data[n] = browse_record(self._cr, self._uid, ids2, obj, self._cache, context=self._context, list_class=self._list_class, fields_process=self._fields_process) + # FIXME: this happen when a _inherits object + # overwrite a field of it parent. Need + # testing to be sure we got the right + # object and not the parent one. + if not isinstance(ids2, browse_record): + data[n] = browse_record(self._cr, + self._uid, ids2, obj, self._cache, + context=self._context, + list_class=self._list_class, + fields_process=self._fields_process) else: data[n] = browse_null() else: @@ -2225,7 +2234,7 @@ class orm(orm_template): return 'length("%s") as "%s"' % (f, f) return '"%s"' % (f,) fields_pre2 = map(convert_field, fields_pre) - order_by = self._parent_order or self._order + order_by = self._parent_order or self._order for i in range(0, len(ids), cr.IN_MAX): sub_ids = ids[i:i+cr.IN_MAX] if d1: