How it works…
- The code maintained by other people (in
- The local-specific code
filestoreof the instance
By having one
virtualenv environment per project, we are sure that the project's dependencies will not interfere with the dependencies of other projects that may be running a different version of Odoo or will use different third-party add-on modules, which require different versions of Python dependencies. This comes at the cost of a little disk space.
In a similar way, by using separate clones of Odoo and third-party add-on modules for our different projects, we are able to let each of these evolve independently and only install updates on the instances that need them, hence reducing the risk of introducing regressions.
bin/odoo script allows us to run the server without having to remember the various paths or activate the
virtualenv environment. This also sets the configuration file for us. You can add additional scripts in there to help you in your day-to-day work. For instance, you can add a script to check out the different third-party projects that you need to run your instance.
Regarding the configuration file, we have only demonstrated the bare minimum options to set up here, but you can obviously set up more, such as the database name, the database filter, or the port on which the project listens. Refer to Chapter 1, Installing the Odoo Development Environment, for more information on this topic.
To facilitate project creation, you can create a template repository containing the empty structure, and fork that repository for each new project. This will save you from retyping the
bin/odoo script, the
.gitignore file, and any other template file you need (continuous integration configuration,
ChangeLog, and so on).
The development of complex modules requires various configuration options, which leads to updating the configuration file whenever you want to try any configuration option. Updating the configuration file frequently can be a headache, and to avoid this, an alternative way is to pass all configuration options from the command line, as follows:
$ source env/bin/activate
- Go to the Odoo source directory:
$ cd src/odoo
- Run the server:
In step 3, we passed a few configuration options directly from the command line. The first is
--add-ons-path, which loads Odoo's core add-ons directory,
addons, and your add-ons directory,
local, in which you will put your own add-on modules. Option
-d will use the
test-14 database or create a new database if it isn't present. The
-i option will install the
purchase modules. Next, we passed the
log-level option and increased the log level to
debug so that it will display more information in the log.
By using the command line, you can quickly change the configuration options. You can also see live logs in the terminal. For all available options, refer to Chapter 1, Installing the Odoo Development Environment, or use the
--help command to view a list of all options and the description of each option.