Working with Odoo
上QQ阅读APP看书,第一时间看更新

Creating a new database in Odoo

If you have installed Odoo on your own server, you will first need to create a database. As you add additional applications to Odoo, the necessary tables and fields will be added to the database you specify.

Tip

Odoo online

If you are using Odoo online, you will not have access to create a new database and instead will use Odoo's one click application installer to manage your Odoo installation.

If you have just installed a fresh copy of Odoo, you will be prompted automatically to create a new Odoo database:

Creating a new database in Odoo

In the preceding screenshot, you can see the Odoo form to create a new database.

Odoo provides basic instructions for creating your database. Let's quickly review the fields and how they are used.

Specifying the master password

The master password is set in the Odoo configuration file. In this form, you are not setting the master password. Instead, you are supplying the master password so that Odoo can be sure you are authorized to create databases. If you enter an incorrect master password or do not enter a master password, you will get an access denied message when you try to create the database.

Note

By default, the master password for Odoo is admin.

For security reasons, it is essential that you change the default master password. Refer to the installation in Chapter 1, Setting Up Odoo, to see how you can change the configuration file to specify an alternative master password.

Selecting a database name

When selecting a database name, choose a name that describes the system and will make the purpose of the database clear. There are a few rules:

  • Your database name cannot contain spaces and must start with a number or letter
  • Also, you will need to avoid commas, periods, and quotes
  • Underscores and hyphens are allowed if they are not the first character in the name

It can also be a good idea to specify in the name whether the database is for development, testing, or production purposes.

For the purposes of our real-world case study, we will use the database name SILKWORM-DEV.

We have chosen the -DEV suffix as we will consider this to be a development database that will not be used for production or even for testing.

Tip

Take the time to consider what you will name your databases. It can be useful to have standard prefixes or suffixes, depending on the purpose of your database. For example, you might use -PROD for your production database or -TEST for the database that you are using for testing.

Loading demonstration data

You will see the Check this box to evaluate Odoo box. If you mark this checkbox when you create a database, Odoo will preload your tables with a host of sample data for each module that is installed. This may include fake customers, suppliers, sales orders, invoices, inbox messages, stock moves, and products. The purpose of the demonstration data is to allow you to run modules through their paces without having to key in a ton of test data.

For the purposes of our real-world case study in this book, do not load any demonstration data.

Specifying our default language

Odoo offers a variety of language translation features with support for more than 20 languages. All of the examples in this book will use the English (US) language option. Be aware that depending on the language you select in Odoo, you might need to have that language also installed in your base operating system.

Choosing a password

Each Odoo database is created with an administrator account, named admin. This is also known as the superuser account. The password you choose during the creation of the database will be the password for the admin account.

Note

Choose any password you wish and click on Create Database to create the SILKWORM-DEV database.

Managing databases in Odoo

The database management interface allows you to perform basic database management tasks, such as backing up or restoring a database. Often with Odoo, it is possible to manage your databases without ever having to go directly into the Postgres database server. It is also possible to set up multiple databases under the same installation of Odoo. For instance, in the future, you might want to install another database, which will load demonstration data and might be used to install applications simply for testing purposes.

Tip

If you have trouble getting to the interface to manage databases, you can access the database management interface directly by going to the path /web/database/manager.