Odoo Help


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

Pascal Tremblay
on 2/7/16, 11:09 AM 792 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,})



Jérémy Kersten (jke)

--Jérémy Kersten (jke)--

| 3 3 5
Jodoigne, Belgium
--Jérémy Kersten (jke)--

Jérémy is a member of the core R&D team since september 2013. He developed several projects for OpenERP version 8 including the eCommerce, the Google Calendar synchronization and the new product variants/configurator. Now, he manages Odoo website and themes for saas.

Jérémy Kersten (jke)
On 2/7/16, 11:27 AM

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
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


Arrays in Java and PHP (simular)



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.


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)


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