Book Image

Odoo 12 Development Cookbook - Third Edition

By : Parth Gajjar, Alexandre Fayolle, Holger Brunn, Daniel Reis
Book Image

Odoo 12 Development Cookbook - Third Edition

By: Parth Gajjar, Alexandre Fayolle, Holger Brunn, Daniel Reis

Overview of this book

Odoo is a powerful framework known for rapid application development. Its latest release, Odoo 12, introduces tons of new features. With this book, you’ll learn how to develop powerful Odoo applications from scratch, using all the latest features. This Odoo cookbook starts by covering Odoo installation and deployment on the server. Next, you’ll explore the Odoo framework with real-world examples. You’ll create a new Odoo module from the ground up and progress to advanced framework concepts. You’ll also learn how to modify existing applications, including Point of Sale (POS). This book is not just limited to backend development; the advanced JavaScript recipes for creating new views and widgets will help you build beautiful UI elements. As you move forward, you’ll gain insights into website development and become a quality Odoo developer by studying performance optimization, debugging, and automated tests. Finally, you’ll learn the latest concepts like multi-website, In-App Purchasing (IAP),, and IoT Box. By the end of the book, you’ll have all the knowledge you need to build powerful Odoo applications. The development best practices used in this book will undoubtedly come handy when you are working with the Odoo framework.
Table of Contents (26 chapters)

To get the most out of this book

This book is meant for developers who have basic knowledge of the Python programming language, as the Odoo backend runs on Python. In Odoo, data files are created with XML, so basic knowledge of XML is required.

This book also covers the backend JavaScript framework, point-of-sale applications, and the website builder, which requires basic knowledge JavaScript, jQuery, and Bootstrap 4.

The community edition of Odoo is open source and freely available, but a few features, including IoT, cohort, and dashboard, are available only in the Enterprise edition, so to follow along with that recipe, you will need the Enterprise edition.

To follow Chapter 24, IoT Box, you will require the Raspberry Pi 3 Model B+, which is available at

Download the example code files

You can download the example code files for this book from your account at If you purchased this book elsewhere, you can visit and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latestversion of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at Note that, the code bundle has the separate folder for each recipe. We also have other code bundles from our rich catalog of books and videos available at Check them out!

Download the color images

Code in Action

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Mount the downloaded WebStorm-10*.dmg disk image file as another disk in your system."

A block of code is set as follows:

    'name': "My library",
    'summary': "Manage books easily",
    'description': """Long description""", 
    'author': "Your name", 
    'website': "", 
    'category': 'Uncategorized', 
    'version': '12.0.1', 
    'depends': ['base'], 
    'data': ['views.xml'], 
    'demo': ['demo.xml'], 

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

from odoo import models, fields   
class LibraryBook(models.Model): 
    _name = '' 
    name = fields.Char('Title', required=True) 
    date_release = fields.Date('Release Date')
author_ids = fields.Many2many(

Any command-line input or output is written as follows:

$ sudo apt-get update

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Odoo has special support for monetary values related to a currency."

Warnings or important notes appear like this.
Tips and tricks appear like this.