Odoo Help


This community 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.


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

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



Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


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