Debian Codegraph @

doc/source/tuto_create_db.rst

raw
1 Create a new database
2 *********************
3
4 To dialog with your `Odoo` server, you need an instance of the
5 :class:`odoorpc.ODOO` class. Let's instanciate it::
6
7 >>> import odoorpc
8 >>> odoo = odoorpc.ODOO('localhost', 'jsonrpc', 8069)
9
10 Two protocols are available: ``jsonrpc`` and ``jsonrpc+ssl``.
11 Then, create your database for the purposes of this tutorial (you need to
12 know the `super` admin password to do this)::
13
14 >>> odoo.db.create('super_password', 'tutorial', demo=True, lang='fr_FR', admin_password='password')
15
16 The creation process may take some time on the server. If you get a timeout
17 error, set a higher timeout before repeating the process::
18
19 >>> odoo.config['timeout'] = 300 # Set the timeout to 300 seconds
20 >>> odoo.db.create('super_password', 'tutorial', demo=True, lang='fr_FR', admin_password='password')
21
22 To check available databases, use the :attr:`odoo.db <odoorpc.ODOO.db>`
23 property with the :func:`list <odoorpc.db.DB.list>` method::
24
25 >>> odoo.db.list()
26 ['tutorial']
27
28 You are now ready to login to your database!
29
30 Documentation about databases management is available
31 :class:`here <odoorpc.db.DB>`.
32
33 :ref:`Next step: Login to your new database <tuto-login>`