Skip to Content
Menu
This question has been flagged
3 Replies
3520 Views

Hello all!

What is the utility of the [ ] that surround the voucher.id variable in this line?

self.write(cr, uid, [voucher.id], { 'move_id': move_id, 'state': 'posted', 'number': name,})

Thanks

Avatar
Discard
Best Answer

function Write take a list of ids as parameter.

So that allow to pass the singleton id as a list.


id = 2

[id] = [2]



Avatar
Discard
Author

Thanks mister!

Best Answer

Its the array variant of python they dont call them arrays but lists.  But just as an array in for example php you can pop, remove, append, index, insert, reverse them :)

Lists in Python

https://docs.python.org/2/tutorial/datastructures.html


Arrays in Java and PHP (simular)

http://php.net/manual/en/language.types.array.php

http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html

Avatar
Discard