There are several ways to set up an Odoo development environment. This chapter proposes one of them; you will certainly find a number of other tutorials on the web explaining other approaches. Keep in mind that this chapter is about a development environment that has different requirements from a production environment.
If you are new to Odoo development, you must know about certain aspects of the Odoo ecosystem. The first recipe will give you a brief introduction to the Odoo ecosystem, and then we will move on to the installation of Odoo for development.
In this chapter, we will cover the following recipes:
- Understanding the Odoo ecosystem
- Easy installation of Odoo from source
- Managing Odoo server databases
- Storing the instance configuration in a file
- Activating Odoo developer tools
- Updating the add-on modules list
Understanding the Odoo ecosystem
Odoo provides the developer with out-of-the-box modularity. Its powerful framework helps the developer to build projects very quickly. There are various characters in the Odoo ecosystem that you should be familiar with before embarking on your journey of becoming a successful Odoo developer.
Odoo comes with two different editions. The first one is the Community Edition, which is open source, and the second one is the Enterprise Edition, which has licensing fees. Unlike other software vendors, Odoo Enterprise Edition is just a pack of extra applications that adds extra features or new apps to the Community Edition. Basically, the Enterprise Edition runs on top of the Community Edition. The Community Edition comes under the Lesser General Public License v3.0 (LGPLv3) license and comes with all of the basic Enterprise Resource Planning (ERP) applications, such as sales, Customer Relationship Management (CRM), invoicing, purchases, and website builder. Alternatively, the Enterprise Edition comes with the Odoo Enterprise Edition License, which is a proprietary license. Odoo Enterprise Edition has a number of advanced features, such as full accounting, studio, Voice over Internet Protocol (VoIP), mobile responsive design, e-sign, marketing automation, delivery and banking integrations, IoT, and more. The Enterprise Edition also provides you with unlimited bugfix support. The following diagram shows that the Enterprise Edition depends on the Community Edition, which is why you need the latter in order to use the former:
You can see a full comparison of both editions here: https://www.odoo.com/page/editions.
Odoo has the largest number of community developers, which is why you will find a large number of third-party apps (modules) on the app store. Some of the free apps use an Affero General Public License version 3 (AGPLv3). You cannot use the proprietary license on your app if your application has dependencies on such apps. Apps with an Odoo proprietary license can be developed only on modules that have LGPL or other proprietary licenses.
The entire code base of Odoo is hosted on GitHub. You can post bugs/issues for stable versions here. You can also propose a new feature by submitting Pull Requests (PR). There are several repositories in Odoo. See the following table for more information:
Every year, Odoo releases one major (Long-Term Support (LTS)) version and a few minor versions. Minor versions are mostly used in Odoo's online SaaS service, meaning that Odoo SaaS users get early access to these features. Major version branches have names such as 14.0, 13.0, and 12.0, while minor version branches have names such as saas-14.1, and saas-14.2 on GitHub. These minor versions are mostly used for Odoo's SaaS platform. The master branch is under development and is unstable, so it is advisable not to use this for production since it might break down your database.
Runbot is Odoo's automated testing environment. Whenever there is a new commit in Odoo's GitHub branch, Runbot pulls those latest changes and creates the builds for the last four commits. Here, you can test all stable and in-development branches. You can even play with the Enterprise Edition and its development branches.
Every build has a different background color, which indicates the status of the test cases. A green background color means that all of the test cases run successfully and you can test that branch, while a red background color means that some test cases have failed on this branch and some features might be broken on that build. You can view the logs for all test cases, which show exactly what happens during installation. Every build has two databases. The all database has all of the modules installed on it, while the base database only has base Odoo modules installed. Every build is installed with basic demo data, and therefore you can test it quickly without extra configurations.
You can access Runbot from the following URL: http://runbot.odoo.com/runbot.
The following credentials can be used to access any Runbot build:
- Login ID: admin Password: admin
- Login ID: demo Password: demo
- Login ID: portal Password: portal
This is a public testing environment, so sometimes it is possible that other users are using/testing the same branch that you are testing.
Odoo app store
Odoo launched the app store a few years back, and this was an instant hit. Right now, there are over 22,000+ different apps hosted there. In the app store, you will find lots of free and paid applications for different versions. This includes specific solutions for different business verticals, such as education, food industries, and medicine. It also includes apps that extend or add new features to existing Odoo applications. The app store also provides numerous beautiful themes for the Odoo website builder. In Chapter 3, Creating Odoo Add-On Modules, we will look at how you can set pricing and currency for your custom module.
You can access the Odoo app store via the following URL: https://www.odoo.com/apps.
You can access the Odoo themes via the following URL: https://www.odoo.com/apps/themes.
Odoo has open sourced several themes with versions 13 and 14. Note that these were paid themes in previous versions. This means that, in Odoo versions 13 and 14, you can download and use those beautiful themes at no extra cost.
Odoo Community Association
Odoo Community Association (OCA) is a non-profit organization that develops/manages community-based Odoo modules. All OCA modules are open source and maintained by Odoo community members. Under the OCA's GitHub account, you will find multiple repositories for different Odoo applications. Apart from Odoo modules, it also contains various tools, a migration library, accounting localizations, and so on.
Here is the URL for OCA's official GitHub account: https://github.com/OCA.
Official Odoo help forum
Odoo has a very powerful framework, and tons of things can be achieved just by using/activating options or by following specific patterns. Consequently, if you run into some technical issues or if you are not sure about some complex cases, then you can post your query on Odoo's official help forum. Lots of developers are active on this forum, including some official Odoo employees.
You can search your questions or post your new questions at the following URL: https://help.odoo.com.help.odoo.com.
Odoo's eLearning platform
Recently, Odoo has launched a new eLearning platform. This platform has lots of videos that explain how to use different Odoo applications. At the time of writing this book, this platform does not have technical videos, just functional ones.
Here is the URL for Odoo's eLearning platform: https://www.odoo.com/slides.
Easy installation of Odoo from source
It is highly recommended to use the Linux Ubuntu operating system for the installation of Odoo, since this is the operating system that Odoo uses for all its tests, debugging, and installations of Odoo Enterprise, in addition to the fact that most developers of Odoo also use GNU/Linux distributions, and is much more likely to get support from the Odoo community for OS-level issues that occur in GNU/Linux than Windows or macOS.
It is also recommended to develop Odoo add-on modules using the same environment (the same distribution and the same version) as the one that will be used in production. This will avoid nasty surprises, such as discovering on the day of deployment that a library has a different version than expected, with a slightly different and incompatible behavior. If your workstation is using a different OS, a good approach is to set up a Virtual Machine (VM) on your workstation and install a GNU/Linux distribution in the VM.
Ubuntu is available as an app in Microsoft Store so you can use that too, if you do not want to switch to Ubuntu OS.
For this book, we will be using Ubuntu Server 18.04 LTS, but you can use any another Debian GNU/Linux OS. Whatever Linux distribution you choose, you should have some notion of how to use it from the command line, and having knowledge of system administration will certainly not do any harm.
We are assuming that you have Ubuntu 18.04 up and running and that you have an account with root access or that sudo has been configured. In the following sections, we will install Odoo's dependencies and download Odoo's source code from GitHub.
Some of the configurations require a system login username, so we will use $(whoami) whenever a login username is required in a command line. This is a shell command that will substitute your login in the command you are typing.
Some operations will definitely be easier if you have a GitHub account. If you don't have one already, go to https://github.com and create one.
How to do it...
To install Odoo from source, perform the following steps:
- Run the following commands to install the main dependencies:
$ sudo apt-get update
$ sudo apt install git python3-pip build-essential wget python3-dev python3-venv python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools libpng12-0 libjpeg-dev gdebi -y
- Download and install wkhtmltopdf:
$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_amd64.deb
$ sudo dpkg -i wkhtmltox_0.12.5-1.trusty_amd64.deb
If you find errors in a previous command, force install the dependencies with the following command:
$ sudo apt-get install -f
- Now, install the PostgreSQL database:
$ sudo apt install postgresql -y
- Configure PostgreSQL:
$ sudo -u postgres createuser --superuser $(whoami)
- Configure git:
$ git config --global user.name "Your Name"
$ git config --global user.email [email protected]
- Clone the Odoo code base:
$ mkdir ~/odoo-dev
$ cd ~/odoo-dev
$ git clone -b 14.0 --single-branch --depth 1 https://github.com/odoo/odoo.git
- Create an odoo-14.0 virtual environment and activate it:
$ python3 -m venv ~/venv-odoo-14.0
$ source ~/venv-odoo-14.0/bin/activate
- Install the Python dependencies of Odoo in venv:
$ cd ~/odoo-dev/odoo/
$ pip3 install -r requirements.txt
- Create and start your first Odoo instances:
$ createdb odoo-test
$ python3 odoo-bin -d odoo-test –i base --addons-path=addons --db-filter=odoo-test$
- Point your browser to http://localhost:8069 and authenticate it by using the admin account and using admin as the password.
If you need RTL support, please install node and rtlcss via the following command:sudo apt-get install nodejs npm -y sudo npm install -g rtlcss
How it works...
In step 1, we installed several core dependencies. These dependencies include various tools, such as git, pip3, wget, Python setup tools, and more. These core tools will help us install other Odoo dependencies using simple commands.
In step 2, we downloaded and installed the wkhtmltopdf package, which is used in Odoo to print PDF documents such as sale orders, invoices, and other reports. Odoo 14.0 needs version 0.12.5 of wkhtmltopdf, and that exact version might be not included in the current Linux distributions. Fortunately for us, the maintainers of wkhtmltopdf provide pre-built packages for various distributions at http://wkhtmltopdf.org/downloads.html and we have downloaded and installed it from that URL.
In step 3, we installed the PostgreSQL database.
In step 4, we created a new database user with the login name of your system. $(whoami) is used to fetch your login name, and the -s option is used to give super user rights. Let's see why we need these configurations.
Odoo uses the psycopg2 Python library to connect with a PostgreSQL database. To access a PostgreSQL database with the psycopg2 library, Odoo uses the following values by default:
- By default, psycopg2 tries to connect to a database with the same username as the current user on local connections, which enables password-less authentication (this is good for the development environment).
- The local connection uses Unix domain sockets.
- The database server listens on port 5432.
That's it! Your PostgreSQL database is now ready to be connected with Odoo.
As this is a development server, we have given --superuser rights to the user. It is OK to give the PostgreSQL user more rights as this will be your development instance. For a production instance, you can use the --createdb command line instead of --superuser to restrict rights. The –superuser rights in a production server will give additional leverage to an attacker exploiting a vulnerability in some part of the deployed code.
If you want to use a database user with a different login, you will need to provide a password for the user. This is done by passing the --pwprompt flag on the command line when creating the user, in which case the command will prompt you for the password.
$ psql -c "alter role $(whoami) with password 'newpassword'"
If this command fails with an error message saying that the database does not exist, it is because you did not create a database named after your login name in step 4 of this recipe. That's fine; just add the --dbname option with an existing database name, such as --dbname template1.
For the development environment, we are using Odoo sourced from GitHub. With git, you can easily switch between different Odoo versions. Also, you can fetch the latest changes with the git pull command.
In step 5, we configured your git user.
In step 6, we downloaded the source code from Odoo's official GitHub repository. We have used the git clone command to download Odoo's source code. We have used a single branch as we only want a branch for the 14.0 version. Also, we have used --depth 1 to avoid downloading the full commit history of the branch. These options will download the source code very quickly, but if you want, you can omit those options.
Odoo developers also propose nightly builds, which are available as tarballs and distribution packages. The main advantage of using git clone is that you will be able to update your repository when new bug fixes are committed in the source tree. You will also be able to easily test any proposed fixes and track regressions so that you can make your bug reports more precise and helpful for developers.
Python virtual environments, or venv for short, are isolated Python workspaces. These are very useful to Python developers because they allow different workspaces with different versions of various Python libraries to be installed, possibly on different Python interpreter versions.
You can create as many environments as you wish using the python3 -m venv ~/newvenv command. This will create a newvenv directory in the specified location, containing a bin/ subdirectory and a lib/python3.6 subdirectory.
In step 7, we created a new virtual environment in the ~/venv-odoo-14.0 directory. This will be our isolated Python environment for Odoo, and all of Odoo's Python dependencies will be installed in this environment.
To activate the virtual environment, we need to use the source command. With the source ~/venv-odoo-14.0/bin/activate command, we have activated the virtual environment.
Installing Python packages
Odoo's source code has a list of Python dependencies in requirements.txt. In step 8, we installed all those requirements via the pip3 install command.
That's it. Now you can run the Odoo instance.
Starting the instance
Now comes the moment you've been waiting for. To start our first instance, in step 9, we first created a new empty database, used the odoo-bin script, and then started the Odoo instance with the following command:
python3 odoo-bin -d odoo-test -i base --addons-path=addons --db-filter=odoo-test$
You can also omit python3 by using ./ before odoo-bin as it is an executable Python script, as follows:
./odoo-bin -d odoo-test –i base --addons-path=addons --db-filter=odoo-test$
With odoo-bin, a script with the following command-line arguments are used:
- -d database_name: Use this database by default.
- --db-filter=database_name$: Only try to connect to databases that match the supplied regular expression. One Odoo installation can serve multiple instances that live in separate databases, and this argument limits the available databases. The trailing $ is important as the regular expression is used in match mode. This enables you to avoid selecting names starting with the specified string.
- --addons-path=directory1,directory2,...: This is a comma- separated list of directories in which Odoo will look for add-ons. This list is scanned at instance creation time to populate the list of available add-on modules in the instance. If you want to use Odoo's Enterprise Edition, then add its directory with this option.
- -i base: This is used to install a base module. This is required when you have created a database via the command line.
If you are using a database user with a database login that is different from your Linux login, you need to pass the following additional arguments:
- --db_host=localhost: Use a TCP connection to the database server.
- --db_user=database_username: Use the specified database login.
- --db_password=database_password: This is the password for authenticating against the PostgreSQL server.
To get an overview of all available options, use the --help argument. We will see more of the odoo-bin script later in this chapter.
When Odoo is started on an empty database, it will first create the database structure that's needed to support its operations. It will also scan the add-ons path to find the available add-on modules and insert some into the initial records in the database. This includes the admin user with the default admin password, which you will use for authentication.
Pointing your web browser to http://localhost:8069/ leads you to the login page of your newly created instance, as shown in the following screenshot:
This is due to the fact that Odoo includes an HTTP server. By default, it listens on all local network interfaces on TCP port 8069.
Managing Odoo server databases
When working with Odoo, all the data in your instance is stored in a PostgreSQL database. All the standard database management tools you are used to are available, but Odoo also proposes a web interface for some common operations.
We are assuming that your work environment is set up and that you have an instance running.
How to do it...
The Odoo database management interface provides tools to create, duplicate, remove, back up, and restore a database. There is also a way to change the master password, which is used to protect access to the database management interface.
Accessing the database management interface
To access the database, perform the following steps:
- Go to the login screen of your instance (if you are authenticated, log out).
- Click on the Manage Databases link. This will navigate to http://localhost:8069/web/database/manager (you can also point your browser directly to that URL):
Setting or changing the master password
If you've set up your instance with default values and haven't modified it yet, as we will explain in the following section, the database management screen will display a warning, telling you that the master password hasn't been set and will advise you to set one with a direct link:
- Click on the Set Master Password button. You will get a dialog box asking you to fill in the New Master Password field:
- Type in a non-straightforward new password and click Continue.
If the master password is already set, click on the Set Master Password button at the bottom of the screen to change it. In the displayed dialog box, type the previous master password and the new one and then click on Continue.
The master password is the server configuration file under the admin_password key. If the server was started without specifying a configuration file, a new one will be generated in ~/.odoorc. Refer to the next recipe for more information about the configuration file.
Creating a new database
This dialog box can be used to create a new database instance that will be handled by the current Odoo server:
- In the database management window, click on the Create Database button, which can be found at the bottom of the screen. This will bring up the following dialog:
- Fill in the form, as follows:
- Master Password: This is the master password for this instance.
- Database Name: Input the name of the database you wish to create.
- Email: Add your email address here; this will be your username later.
- Password: Type in the password you want to set for the admin user of the new instance.
- Phone Number: Set the phone number (optional).
- Language: Select the language you wish to be installed by default in the new database in the drop-down list. Odoo will automatically load the translations for the selected language.
- Country: Select the country of the main company in the drop-down list. Selecting this will automatically configure a few things, including company currency.
- Demo data: Check this box to obtain demonstration data. This is useful for running interactive tests or setting up a demonstration for a customer, but it should not be checked for a database that is designed to contain production data.
If you wish to use the database to run the automated tests of the modules (refer to Chapter 7, Debugging Modules), you need to have the demonstration data, as the vast majority of the automated tests in Odoo depend on these records in order to run successfully.
- Click on the Continue button and wait for a while until the new database is initialized. You will then be redirected to the instance and connected as the administrator.
If you are redirected to a login screen, this is probably because the --db-filter option was passed to Odoo and the new database name didn't match the new database name. Note that the odoo-bin start command does this silently, making only the current database available. To work around this, simply restart Odoo without the start command, as shown in the Easy installation of Odoo from source recipe of this chapter. If you have a configuration file (refer to the Storing the instance configuration in a file recipe later in this chapter), and then check that the db_filter option is unset or set to a value matching the new database name.
Duplicating a database
Often, you will have an existing database, and you will want to experiment with it to try a procedure or run a test, but without modifying the existing data. The solution here is simple: duplicate the database and run the test on the copy. Repeat this as many times as required:
- In the database management screen, click on the Duplicate Database link next to the name of the database you wish to clone:
- Fill in the form as follows:
- Master Password: This is the master password of the Odoo server.
- New Name: The name you want to give to the copy.
- Click on the Continue button.
- You can then click on the name of the newly created database in the database management screen to access the login screen for that database.
Removing a database
- In the database management screen, you will find the Delete button next to the name of the database. Clicking on it will bring up a dialog like the following screenshot:
- Fill in the form and complete the Master Password field, which is the master password of the Odoo server.
- Click on the Delete button.
Caution! Potential data loss!
Backing up a database
- In the database management screen, you will find the Backup button next to the database name. Clicking on it will bring up dialog like the following screenshot:
- Fill in the form as follows:
- Master Password: This is the master password of the Odoo server.
- Backup Format: Always use zip for a production database, as this is the only real full backup format. Only use the pg_dump format for a development database when you don't really care about the file store.
- Click on the Backup button. The backup file will then be downloaded to your browser.
Restoring a database backup
- In the database management screen, you will find a Restore Database button at the bottom of the screen. Clicking on it will bring up a dialog like the following screenshot:
- Fill in the form as follows:
- Master Password: This is the master password of the Odoo server.
- File: This is a previously downloaded Odoo backup.
- Database Name: Provide the name of the database in which the backup will be restored. The database must not exist on the server.
- This database might have been moved or copied: Choose This database was moved if the original database was on another server or if it has been deleted from the current server. Otherwise, choose This database is a copy, which is the safe default option.
- Click on the Continue button.
It isn't possible to restore a database on top of itself. If you try to do this, you will get an error message (Database restore error: Database already exists). You need to remove the database first.
How it works...
These features, apart from the Change master password screen, run PostgreSQL administration commands on the server and report back through the web interface.
The master password is a very important piece of information that only lives in the Odoo server configuration file and is never stored in the database. There used to be a default value of admin, but using this value is a security liability, which is well-known. In Odoo v9 and later, this is identified as an unset master password, and you are urged to change it when accessing the database administration interface. Even if it is stored in the configuration file under the admin_passwd entry, this is not the same as the password of the admin user; these are two independent passwords. The master password is set for an Odoo server process, which itself can handle multiple database instances, each of which has an independent admin user with their own password.
Remember that we are considering a development environment in this chapter. The Odoo database management interface is something that needs to be secured when you are working on a production server, as it gives access to a lot of sensitive information, especially if the server hosts Odoo instances for several different clients.
To create a new database, Odoo uses the PostgreSQL createdb utility and calls the internal Odoo function to initialize the new database in the same way as when you start Odoo on an empty database.
To duplicate a database, Odoo uses the --template option of createdb, passing the original database as an argument. This essentially duplicates the structure of the template database in the new database using internal and optimized PostgreSQL routines, which is much faster than creating a backup and restoring it (especially when using the web interface, which requires downloading the backup file and uploading it again).
Backup and restore operations use the pg_dump and pg_restore utilities, respectively. When using the zip format, the backup will also include a copy of the file store that contains a copy of the documents when you configure Odoo to not keep these in the database, which is the default option in 14.0. Unless you change it, these files reside in ~/.local/share/Odoo/filestore.
If the backup gets large, downloading it may fail. This is either because the Odoo server itself is unable to handle the large file in memory or because the server is running behind a reverse proxy because there is a limit to the size of HTTP responses that were set in the proxy. Conversely, for the same reasons, you will likely experience issues with the database restore operation. When you start running into these issues, it is time to invest in a more robust external backup solution.
Experienced Odoo developers generally don't use the database management interface and perform operations from the command line. To initialize a new database with demo data, for instance, the following single-line command can be used:
The additional bonus of this command line is that you can request the installation of add-ons while you are using, for instance, -i sale,purchase,stock.
To duplicate a database, stop the server and run the following commands:
$ createdb -T dbname newdbname
$ cd ~/.local/share/Odoo/filestore # adapt if you have changed the data_dir
$ cp -r dbname newdbname
$ cd -
Note that, in the context of development, the file store is often omitted.
The use of createdb -T only works if there are no active sessions on the database, which means that you have to shut down your Odoo server before duplicating the database from the command line.
$ dropdb dbname
$ rm -rf ~/.local/share/Odoo/filestore/dbname
To create a backup (assuming that the PostgreSQL server is running locally), use the following command:
$ pg_dump -Fc -f dbname.dump dbname
$ tar cjf dbname.tgz dbname.dump ~/.local/share/Odoo/filestore/dbname
To restore the backup, run the following command:
$ tar xf dbname.tgz
$ pg_restore -C -d dbname dbname.dump
Storing the instance configuration in a file
The odoo-bin script has dozens of options, and it is tedious to remember them all, as well as remembering to set them properly when starting the server. Fortunately, it is possible to store them all in a configuration file and to only specify by hand the ones you want to alter, for example, for development.
How to do it...
For this recipe, perform the following steps:
- To generate a configuration file for your Odoo instance, run the following command:
$ ./odoo-bin --save --config myodoo.cfg --stop-after-init
- You can add additional options, and their values will be saved in the generated file. All the unset options will be saved with their default value set. To get a list of possible options, use the following command:
$ ./odoo-bin --help | less
This will provide you with some help about what the various options perform.
- To convert from the command-line form to the configuration form, use the long option name, remove the leading dashes, and convert the dashes in the middle into underscores. --without-demo then becomes without_demo. This works for most options, but there are a few exceptions, which are listed in the following section.
- Edit the myodoo.cfg file (use the table in the following section for some parameters you may want to change). Then, to start the server with the saved options, run the following command:
$ ./odoo-bin -c myodoo.cfg
How it works...
At startup, Odoo loads its configuration in three passes. First, a set of default values for all options is initialized from the source code, then the configuration is parsed, and then any value that's defined in the file overrides the defaults. Finally, the command-line options are analyzed, and their values override the configuration that was obtained from the previous pass.
As we mentioned earlier, the names of the configuration variables can be found from the names of the command-line options by removing the leading dashes and converting the middle dashes into underscores. There are a few exceptions to this, notably the following:
Here is a list of options that are commonly set through the configuration file:
The parsing of the configuration file by Odoo is now using the Python ConfigParser module. However, the implementation in Odoo 11.0 has changed, and it is no longer possible to use variable interpolation. So, if you are used to defining values for variables from the values of other variables using the %(section.variable)s notation, you will need to change your habits and revert to explicit values.
Activating Odoo developer tools
When using Odoo as a developer, you need to know how to activate developer mode in the web interface so that you can access the technical settings menu and developer information. Enabling debug mode will expose several advance configuration options and fields. These options and fields are hidden in Odoo for better usability because they are not used on a daily basis.
How to do it...
To activate developer mode in the web interface, perform the following steps:
- Connect to your instance and authenticate as admin.
- Go to the Settings menu.
- Scroll to the bottom and locate the Developer Tools section:
- Click on the Activate the developer mode link.
- Wait for the UI to reload.
It is also possible to activate the developer mode by editing the URL. Before the # sign, insert ?debug=1. For example, if your current URL is http://localhost:8069/web#menu_id=102&action=94 and you want to enable developer mode, then you need to change that URL to http://localhost:8069/web?debug=1#menu_id=102&action=94. Furthermore, if you want debug mode with assets, then change the URL to http://localhost:8069/web?debug=assets#menu_id=102&action=94.
To exit developer mode, you can perform any one of the following operations:
- Edit the URL and write ?debug=0 in the query string.
- Use Deactivate the developer mode from the same place in the Settings menu.
- Click on the bug icon in the top menu and click on the Leave Developer Tools option.
Lots of developers are using browser extensions to toggle debug mode. By using this, you can toggle debug mode quickly without accessing the settings menu. These extensions are available for Firefox and Chrome. Take a look at the following screenshot. It will help you to identify the plugin in the Chrome store:
The behavior of debug mode has changed since Odoo v13. Since v13, the status of the debug mode is stored in session, implying that even if you have removed ?debug from the URL, debug mode will still be active.
How it works...
- You get tooltips when hovering over a field in a form view or over a column in list view, providing technical information about the field (internal name, type, and so on)
- A drop-down menu with a bug icon is displayed next to the user's menu in the top-right corner, giving access to technical information about the model being displayed, the various related view definitions, the workflow, custom filter management, and so on.
Updating the add-on modules list
Start your instance and connect to it using the Administrator account. After doing this, activate developer mode (if you don't know how to activate developer mode, refer to Chapter 1, Installing the Odoo Development Environment).
How to do it…
To update the list of available add-on modules in your instance, you need to perform the following steps:
- Open the Apps menu.
- Click on Update Apps List:
- In the dialog, click on the Update button:
- At the end of the update, you can click on the Apps entry to see the updated list of available add-on modules. You will need to remove the default filter on Apps in the search box to see all of them.
How it works…
When the Update button is clicked, Odoo will read the add-ons path configuration variable. For each directory in the list, it will look for immediate subdirectories containing an add-on manifest file, which is a file named __manifest__.py that's stored in the add-on module directory. Odoo reads the manifest, expecting to find a Python dictionary. Unless the manifest contains a key installable instance set to False, the add-on module metadata is recorded in the database. If the module was already present, the information is updated. If not, a new record is created. If a previously available add-on module is not found, the record is not deleted from the list.
An updated apps list is only required if you added the new add-on path after initializing the database. If you add the new add-on path to the configuration file before initializing the database, then there will be no need to update the module list manually.
To summarize what we have learned so far, after installing, you can start the Odoo server by using the following command line (if you are using a virtual environment, then you need to activate it first):
python3 odoo-bin -d odoo-test -i base --addons-path=addons --db-filter=odoo-test
Once you run the module, you can access Odoo from http://localhost:8069.
You can also use a configuration file to run Odoo as follows:
./odoo-bin -c myodoo.cfg