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 518 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)--
4550
| 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
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: 518 times
Last updated: 2/7/16, 12:16 PM