How to Configure Odoo 16 in Visual Studio Code on Ubuntu 21.10


Odoo is a powerful and open-source business management software suite that offers a wide range of applications for various business needs. It provides features like accounting, inventory management, CRM, e-commerce, and more. Visual Studio Code (VS Code) is a popular code editor that is lightweight, customizable, and supports many programming languages and extensions. In this blog, we will guide you through the process of configuring Odoo 16 in Visual Studio Code on Ubuntu 21.10, making it easier for developers and businesses to work with Odoo.


Before we dive into the configuration process, ensure that you have the following prerequisites in place

  1. Ubuntu 21.10 installed on your machine.
  2. Visual Studio Code installed.
  3. A basic understanding of Linux terminal commands.

Now, let’s go through the steps to configure Odoo 16 in Visual Studio Code

Step 1: Install Odoo 16 on Ubuntu 21.10

To start, you need to install Odoo 16 on your Ubuntu system. You can do this by following these steps

  1. Open the terminal and update your package list
   sudo apt update
  1. Install some required packages
   sudo apt install python3-pip python3-dev libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev build-essential libssl-dev libffi-dev libmysqlclient-dev libjpeg-dev liblcms2-dev libblas-dev libatlas-base-dev
  1. Install PostgreSQL, a database management system
  sudo apt install postgresql
  1. Create a new PostgreSQL user for Odoo
   sudo su - postgres
   createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo
  1. Install the required Python packages
   sudo pip3 install -r https://github.com/odoo/odoo/raw/16.0/requirements.txt
  1. Download and install Odoo 16 from the official GitHub repository
  git clone https://www.github.com/odoo/odoo --depth 1 --branch 16.0 --single-branch .
  1. Set up Odoo configuration by creating a configuration file
   cp ~/odoo/debian/odoo.conf /etc/odoo.conf
  1. Edit the configuration file
   sudo nano /etc/odoo.conf

Replace the contents with the following, adjusting the database user and password

   admin_passwd = your_admin_password
   db_host = False
   db_port = False
   db_user = odoo
   db_password = your_db_password
   addons_path = /usr/lib/python3/dist-packages/odoo/addons
   logfile = /var/log/odoo/odoo.log
  1. Create a log directory and change its ownership
   sudo mkdir /var/log/odoo
   sudo chown odoo: /var/log/odoo

Create a system service for Odoo

<code>sudo nano /etc/systemd/system/odoo.service</code> Add the following content: <code>[Unit] Description=Odoo Documentation=http://www.odoo.com [Service] # Ubuntu/Debian convention: Type=simple ExecStart=/usr/bin/python3 /opt/odoo/odoo-bin -c /etc/odoo.conf [Install] WantedBy=default.target</code>

Reload the systemd manager configuration

<code>sudo systemctl daemon-reload</code>

Start the Odoo service and enable it to start on boot

<code>sudo systemctl start odoo sudo systemctl enable odoo</code>

Verify that Odoo is running by accessing it in your web browser at http


Now, Odoo 16 is up and running on your Ubuntu 21.10 system. You can access it through your web browser. Next, we’ll configure Visual Studio Code for Odoo development.

Step 2: Configure Visual Studio Code for Odoo 16 Development

To make Odoo development more efficient, we’ll configure Visual Studio Code with relevant extensions and settings.

  1. Install the “Python” extension in Visual Studio Code for Python development.
  2. Install the “XML Tools” extension for better XML file handling.
  3. Install the “EditorConfig for VS Code” extension to maintain consistent coding styles.
  4. Open your Odoo project folder in Visual Studio Code.
  5. Create a virtual environment for your Odoo project. In the terminal, navigate to your project folder and run the following commands:
   python3 -m venv odoo-venv
   source odoo-venv/bin/activate
  1. Install the required Python packages for your project within the virtual environment
   pip install -r requirements.txt
  1. Configure Visual Studio Code to use the virtual environment you created. Press Ctrl + Shift + P, type “Python: Select Interpreter,” and choose the interpreter from your virtual environment (e.g., odoo-venv).
  2. Install the “EditorConfig for VS Code” extension to maintain consistent coding styles.
  3. Open the Odoo project folder in Visual Studio Code and start coding.


In this blog, we have covered the steps to configure Odoo 16 in Visual Studio Code on Ubuntu 21.10. With this setup, you can streamline your Odoo development process, making it more efficient and organized. Visual Studio Code’s powerful features and extensions, combined with the capabilities of Odoo 16, provide an excellent environment for developing and customizing Odoo solutions to meet your business needs. Happy coding!

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button