Improve browse record when object of an relation field doesn't exist

This happend on the DB creation for res.user on object from ir
This commit is contained in:
Cédric Krier committed 2008-02-20 18:00:12 +01:00
1 parent 9b10252833
commit 4477b2a1ea
1 file changed
+4 -2
+4 -2
View File
@@ -104,8 +104,10 @@ class BrowseRecord(object):
# create browse records for 'remote' objects
for data in datas:
for i, j in ffields:
obj = self._table.pool.get(j._obj)
if not obj:
continue
if j._type in ('many2one', 'one2one'):
obj = self._table.pool.get(j._obj)
if not j._classic_write and data[i]:
ids2 = data[i][0]
else:
@@ -116,7 +118,7 @@ class BrowseRecord(object):
list_class=self._list_class)
elif j._type in ('one2many', 'many2many') and len(data[i]):
data[i] = self._list_class([BrowseRecord(self._cursor,
self._user, x, self._table.pool.get(j._obj),
self._user, x, obj,
self._cache, context=self._context,
list_class=self._list_class) for x in data[i]],
self._context)