Odoo Help

0

What is the utility of the [ ] that surround a variable in a python line?

By
Pascal Tremblay
on 2/7/16, 11:09 AM 619 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

1

function Write take a list of ids as parameter.

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


id = 2

[id] = [2]



Thanks mister!

Pascal Tremblay
on 2/7/16, 11:48 AM
0
M Grmn
On 2/7/16, 12:16 PM

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

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 2/7/16, 11:09 AM
Seen: 619 times
Last updated: 2/7/16, 12:16 PM