Fix test on to_location_warehouse for XML-RPC for issue1380

Tuple in XML-RPC are list
(transplanted from 5522087017922d66c30097f6000a484559395abe)
This commit is contained in:
Cédric Krier committed 2010-01-19 14:12:13 +01:00
1 parent bba53cba1c
commit 25dac7424e
1 file changed
+8 -5
+8 -5
View File
@@ -1,7 +1,7 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
"Move"
from trytond.osv import fields, OSV
from trytond.osv import fields, OSV, OPERATORS
from decimal import Decimal
import datetime
@@ -305,10 +305,11 @@ class Move(OSV):
def process_args(args):
i = 0
while i < len(args):
if isinstance(args[i], list):
process_args(args[i])
if isinstance(args[i], tuple) \
and args[i][0] == 'to_location_warehouse':
#add test for xmlrpc that doesn't handle tuple
if (isinstance(args[i], tuple) or \
(isinstance(args[i], list) and len(args[i]) > 2 and \
args[i][1] in OPERATORS)) and \
args[i][0] == 'to_location_warehouse':
location_id = False
if args[i][2]:
location = location_obj.browse(cursor, user,
@@ -316,6 +317,8 @@ class Move(OSV):
if location.type == 'warehouse':
location_id = location.input_location.id
args[i] = ('to_location', args[i][1], location_id)
elif isinstance(args[i], list):
process_args(args[i])
i += 1
process_args(args)
return super(Move, self).search(cursor, user, args, offset=offset,