Odoo Help

Welcome!

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.

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

Jérémy Kersten (jke)

--Jérémy Kersten (jke)--
2993
| 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
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

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)

Stats

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