[FIX] allow related fields to point to one2many and many2many fields

lp bug: https://launchpad.net/bugs/356628 fixed

bzr revid: chs@tinyerp.com-20091201131908-k5l5tmtpjq3m975x
This commit is contained in:
Christophe Simonis 2009-12-01 14:19:08 +01:00
parent bb6e26450e
commit 229c73d741
1 changed files with 7 additions and 1 deletions

View File

@ -744,7 +744,7 @@ class related(function):
except:
t_data = False
break
if field_detail['type'] in ('one2many', 'many2many'):
if field_detail['type'] in ('one2many', 'many2many') and i != len(self.arg) - 1:
t_data = t_data[self.arg[i]][0]
else:
t_data = t_data[self.arg[i]]
@ -760,6 +760,12 @@ class related(function):
for r in res:
if res[r]:
res[r] = (res[r], ng[res[r]])
elif self._type in ('one2many', 'many2many'):
for r in res:
if res[r]:
res[r] = [x.id for x in res[r]]
return res
def __init__(self, *arg, **args):