Allow child_of query on id
This commit is contained in:
1 parent
5f6d560fd0
commit
ccf3cd510d
1 file changed
+10
@@ -1861,6 +1861,16 @@ class ORM(object):
|
||||
fargs = args[i][0].split('.', 1)
|
||||
field = table._columns.get(fargs[0], False)
|
||||
if not field:
|
||||
if args[i][0] == 'id' and args[i][1] == 'child_of':
|
||||
ids2 = args[i][2]
|
||||
def _rec_get(ids, table, parent):
|
||||
if not ids:
|
||||
return []
|
||||
ids2 = table.search(cursor, user,
|
||||
[(parent, 'in', ids)], context=context)
|
||||
return ids2 + _rec_get(ids2, table, parent)
|
||||
args[i] = (args[i][0], 'in', ids2 + \
|
||||
_rec_get(ids2, table, table._parent_name), table)
|
||||
i += 1
|
||||
continue
|
||||
if len(fargs) > 1:
|
||||
|
||||
Reference in new issue
Block a user