This question has been flagged
2 Replies
3789 Views

I am trying to search for records in account.move.line by partner_ids. I'm first searching the res.partner table and then  passing the ids from that search into the account_move_line_ids search but I get an error "INVALID LEAF". Can someone help me understand whats going wrong?


supplier_ids = sock.execute( dbname, uid, pwd, 'res.partner', 'search', [( 'supplier', '=', True ), '|', ( 'active', '=', True ), ( 'active', '=', False )] )
account_move_line_ids = sock.execute( dbname, uid, pwd, 'account.move.line', 'search', [( 'partner_id', 'IN', supplier_ids )] )

Avatar
Discard
Best Answer

Hi Jesse,

You must use 'in' instead of 'IN' as,

account_move_line_ids = sock.execute(dbname,uid,pwd,'account.move.line','search',[('partner_id','in',supplier_ids)])
Avatar
Discard
Author

Thanks. I knew I was missing something simple never thought to change the case of IN. :(

Best Answer

Hello jesse Rye

can you try like

supplier_ids = sock.execute( dbname, uid, pwd, 'res.partner', 'search', [( 'supplier', '=', True ), '|', ( 'active', '=', True ), ( 'active', '=', False )] )

 move_id = []

for move in supplier_ids:
           id = sock.execute( dbname, uid, pwd, 'account.move.line', 'search', [( 'partner_id', 'IN', move )] ).id
          move_id.append(id)

print "===========", move_id

Avatar
Discard