Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Odoo 15 Development Essentials

You're reading from   Odoo 15 Development Essentials Enhance your Odoo development skills to create powerful business applications

Arrow left icon
Product type Paperback
Published in Feb 2022
Publisher Packt
ISBN-13 9781800200067
Length 548 pages
Edition 5th Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Daniel Reis Daniel Reis
Author Profile Icon Daniel Reis
Daniel Reis
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Section 1: Introduction to Odoo Development
2. Chapter 1: Quick Start Using the Developer Mode FREE CHAPTER 3. Chapter 2: Preparing the Development Environment 4. Chapter 3: Your First Odoo Application 5. Chapter 4: Extending Modules 6. Section 2: Models
7. Chapter 5: Importing, Exporting, and Module Data 8. Chapter 6: Models – Structuring the Application Data 9. Section 3: Business Logic
10. Chapter 7: Recordsets – Working with Model Data 11. Chapter 8: Business Logic – Supporting Business Processes 12. Chapter 9: External API – Integrating with Other Systems 13. Section 4: Views
14. Chapter 10: Backend Views – Designing the User Interface 15. Chapter 11: Kanban Views and Client-Side QWeb 16. Chapter 12: Creating Printable PDF Reports with Server-Side QWeb 17. Chapter 13: Creating Web and Portal Frontend Features 18. Section 5: Deployment and Maintenance
19. Chapter 14: Understanding Odoo Built-In Models 20. Chapter 15: Deploying and Maintaining Production Instances 21. Other Books You May Enjoy

Installing Odoo in your workstation

Using an Odoo SaaS trial database will be the default choice for this chapter. For the rest of the book, we will use a local Odoo installation, and in Chapter 2, Preparing the Development Environment, we will guide you through this process.

It is still worth noting that there are a few prepackaged installation alternatives for Odoo. We will briefly guide you through the available options in case you want to try any of them:

  • Install Odoo with a prepackaged installer for your operating system: This is a good option if you're new to Odoo and want to quickly have a local environment running. Prepackaged installers are available for the following: Windows (EXE installer); Debian/Ubuntu (DEB package), and CentOS/RHEL (RPM package).
  • Install Odoo using a Docker container: This could be a good option if you have experience with Docker and already have it installed on your system. If you're not confident with Docker, you might want to try another option so that learning Docker doesn't distract you from your current goal (learning Odoo development).

Odoo packages can be downloaded from https://download.odoo.com. They are available for all stable Odoo versions, as well as for the master branch corresponding to the latest development version. We will explain each of these options in the following sections.

For additional information on installing Odoo, you can refer to the official documentation at https://www.odoo.com/documentation/15.0/setup/install.html.

Installing on Windows using the all-in-one installer

Odoo provides an all-in-one installer for Windows, providing everything needed to run Odoo: a Python 3 runtime environment, a PostgreSQL database server, and the Odoo server with the required dependencies.

The installer can be downloaded from https://download.odoo.com. Select the desired version from the home page: 15 (stable) - Community Edition. The daily builds should be in 15.0/nightly/windows, and the latest build should be at the bottom of the list.

The installer is straightforward to follow. Odoo will be automatically started at the end of the installation.

It will also create a Windows service to automatically start the Odoo and PostgreSQL services when the machine starts. Remember this when you try other installation options such as the source code installation – port 8069 will already be used by the Windows installation, and this will prevent other installations from using the same port.

Installing on Linux using a pre-packaged installer

The Odoo download site (https://download.odoo.com) provides repositories with official packages for the Debian family (including Ubuntu) and for RHEL/CentOS.

Installation instructions for using the system-packed installers (apt or yum) are provided on the home page. Make sure that you replace the Odoo version used in the command line examples with your target one – for example, 15.0.

Before installing Odoo 15 on our Linux system, you should install the PostgreSQL database. This way, Odoo will be able to create and configure its user.

Installing Odoo using Docker containers

Docker provides a convenient multi-platform solution to run applications. It can be used to run applications on Windows, Linux, and macOS. The container technology is simple to use and resource-efficient when compared to classic virtual machines.

You must first have Docker installed on your system. Docker Desktop is the community edition and is free to use. It can be downloaded from https://www.docker.com. It is worth referring to the Docker website for the latest installation details. Docker relies on virtualization hardware features, so make sure that your basic input/output system (BIOS) has these features enabled.

General guidance on how to install and run Docker can be found at https://docs.docker.com/engine/install.

For example, for Ubuntu systems, the detailed installation instructions point to https://docs.docker.com/engine/install/ubuntu/.

Important post-installation steps – such as running Docker with a non-root user – can be found at https://docs.docker.com/engine/install/linux-postinstall/.

Docker Desktop for Windows requires Hyper-V, which is only available in Windows 10 Enterprise or Education releases. Up-to-date details should be available at https://docs.docker.com/desktop/windows/install/.

Docker Desktop for Mac requires macOS 10.14 or later.  Up-to-date details should be available at https://docs.docker.com/desktop/mac/install/.

Note

Docker Toolbox used to be available as an alternative for other Windows and macOS versions, but this distribution is now deprecated. Docker Toolbox bundles VirtualBox and provides a preconfigured shell that should be used as the command-line environment to operate Docker containers. See https://docs.docker.com/toolbox/ for more details.

The Odoo Docker official images are available on Docker Hub at https://hub.docker.com/_/odoo. There, we can also find basic instructions to get started with the Odoo Docker images. To run Odoo, two Docker containers will be created: one for the PostgreSQL database and the other for the Odoo server.

The installation and operation are done from the command line. To install the PostgreSQL Docker container, run the following:

$ docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo -e POSTGRES_DB=postgres --name db postgres:13

This will download the latest PostgreSQL image from the internet and start a container for it to run as a background job.

Next, install and run the Odoo server container, linking it to the PostgreSQL container we just started, and exposing it on port 8069:

$ docker run -t -p 8069:8069 --name odoo --link db:db odoo:15.0 -d odoo15

With this, you will see the live Odoo server log in your terminal window, and you will be able to access the Odoo instance by opening http://localhost:8069 with your chosen web browser.

Note

The Odoo server can fail to start if port 8069 is already in use. For instance, it could be in use by an already running Odoo server. In this case, you could look for and stop the running service (for example, by looking at the list of running services) or try to start this Odoo server on a different port by changing the -p option. For example, to use port 8070, use -p 8070. In that case, you can also use -d <dbname> to set the database name that this instance should use.

There are a few basic commands you should know to help manage these Docker containers:

  • docker stop <name>: Stops a container
  • docker start <name>: Starts a container
  • docker start -a <name>: Starts a container and attaches the output –  such as the server log – to the terminal window
  • docker attach <name>: Reattaches a container's output to the current terminal window
  • docker ps: Lists the current Docker containers

These are the basic commands needed to operate our Docker containers.

In case you get into trouble running the containers, here is a recipe to start over:

$ docker container stop db
$ docker container rm db
$ docker container stop odoo
$ docker container rm odoo

The Docker technology has more potential, and it might be interesting to learn more about it. The Docker website has good documentation to learn from, and a good place to get started is https://www.docker.com/get-started.

You have been reading a chapter from
Odoo 15 Development Essentials - Fifth Edition
Published in: Feb 2022
Publisher: Packt
ISBN-13: 9781800200067
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime