| 1 |
.. _tuto-login: |
| 2 |
|
| 3 |
Login to your new database |
| 4 |
************************** |
| 5 |
|
| 6 |
Use the :func:`login <odoorpc.ODOO.login>` method on a database with the |
| 7 |
account of your choice:: |
| 8 |
|
| 9 |
>>> odoo.login('tutorial', 'admin', 'password') |
| 10 |
|
| 11 |
.. note:: |
| 12 |
|
| 13 |
Under the hood the login method creates a cookie, and all requests |
| 14 |
thereafter which need a user authentication are cookie-based. |
| 15 |
|
| 16 |
Once logged in, you can check some information through the |
| 17 |
:class:`environment <odoorpc.ODOO.env>`:: |
| 18 |
|
| 19 |
>>> odoo.env.db |
| 20 |
'tutorial' |
| 21 |
>>> odoo.env.context |
| 22 |
{'lang': 'fr_FR', 'tz': 'Europe/Brussels', 'uid': 1} |
| 23 |
>>> odoo.env.uid |
| 24 |
1 |
| 25 |
>>> odoo.env.lang |
| 26 |
'fr_FR' |
| 27 |
>>> odoo.env.user.name # name of the user |
| 28 |
'Mitchell Admin' |
| 29 |
>>> odoo.env.user.company_id.name # the name of its company |
| 30 |
'YourCompany' |
| 31 |
|
| 32 |
From now, you can easily execute any kind of queries on your |
| 33 |
`Odoo` server (execute model methods, trigger workflow, download reports...). |
| 34 |
|
| 35 |
:ref:`Next step: Execute RPC queries <tuto-execute-queries>` |