From 71d927fc0b84e691d2fae6475f1ea4a88108e874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 8 Oct 2008 15:50:37 +0200 Subject: [PATCH] Handle True, False as argument on one2many --- trytond/osv/orm.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/trytond/osv/orm.py b/trytond/osv/orm.py index e40dba42f6..5c2fb442ee 100644 --- a/trytond/osv/orm.py +++ b/trytond/osv/orm.py @@ -2398,14 +2398,24 @@ class ORM(object): args[i][2], [], args[i][1], context=context)] else: ids2 = args[i][2] - if not ids2: + + table_query = '' + table_args = [] + if field_obj.table_query(context): + table_query, table_args = field_obj.table_query(context) + table_query = '(' + table_query + ') AS ' + + if ids2 == True or ids2 == False: + query1 = 'SELECT "' + field._field + '" ' \ + 'FROM ' + table_query + '"' + field_obj._table + '"' + query2 = table_args + clause = 'inselect' + if ids2 == False: + clause = 'notinselect' + args[i] = ('id', clause, (query1, query2)) + elif not ids2: args[i] = ('id', '=', '0') else: - table_query = '' - table_args = [] - if field_obj.table_query(context): - table_query, table_args = field_obj.table_query(context) - table_query = '(' + table_query + ') AS ' if len(ids2) < cursor.IN_MAX: query1 = 'SELECT "' + field._field + '" ' \ 'FROM ' + table_query + '"' + field_obj._table + '" ' \