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
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Odoo 12 Development Essentials
Odoo 12 Development Essentials

Odoo 12 Development Essentials: Fast-track your Odoo development skills to build powerful business applications , Fourth Edition

eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Odoo 12 Development Essentials

Preparing the Development Environment

Before we dive into Odoo development, we need to set up our development environment and learn the basic administration tasks for it.

In this chapter, we will learn how to set up the working environment where we will build our Odoo applications. We will set up an Ubuntu system to host the development server instance. This can be a cloud server, a local network server, or a subsystem in your Windows 10 computer.

We will learn how to do the following:

  • Set up the host computer, either an Ubuntu system or a Windows 10 system, with the Windows Subsystem for Linux
  • Install Odoo from source, including the installation of the database and the system dependencies
  • Manage Odoo databases includes creating, dropping, and copying
  • Configure the Odoo server options
  • Find and install community add-on modules
  • Use virtual environments to manage...

Technical requirements

This chapter will guide you to install Odoo from source in your development computer. Ideally, we need an Ubuntu 18.04 operating system. A Windows 10 system is also an option, since we will explain how to set up Ubuntu in the Windows Subsystem for Linux.

Some reference code for this chapter can be found in the book's GitHub repository, https://github.com/PacktPublishing/Odoo-12-Development-Essentials-Fourth-Edition, in the ch02/ directory.

Setting up a host for the Odoo server

A Debian/Ubuntu system is recommended to run Odoo servers. While Odoo is multi-platform and can run on a variety of operating systems, it's also true that the Odoo R&D team considers Debian the reference deployment platform. In fact, Odoo's own SaaS operations are known to be Debian-based. It is also the most popular choice in the community. This means that it will be easier to find help or advice if you use Debian or Ubuntu. Even if you're from a Windows background, it will be important that you have some knowledge about it.

You will still be able to work from your favorite desktop system, be it Windows, Mac, or other Linux flavors, such as CentOS.

Keep in mind that these instructions are intended to set up a new system for development. If you want to try some of them in an existing system, always take a backup ahead of...

Installing Odoo from source

In Chapter 1, Quick Start Using the Developer Mode, we discussed the different options available to quickly get Odoo running on our computer. We want to go a little deeper, and run Odoo directly from the source code.

Odoo is built using the Python programming language, and it uses the PostgreSQL database for data storage; these are the two main requirements of an Odoo host. To run Odoo from source, we will first need to install the Python libraries it depends on. The Odoo source code can then be downloaded from GitHub. While we can download a ZIP file or tarball, we will see that it's better if we get the sources using the Git version control application; it'll help us to have it installed on our Odoo host as well.

The exact dependency installation may vary depending on your operating system and on the Odoo version you are installing. If you...

Managing Odoo databases

We've seen how to create and initialize new Odoo databases from the command line. There are more commands worth knowing about for managing databases.

Although the Odoo server automatically takes care of managing databases, we can manually create PostgreSQL databases from the command line, using the following:

$ createdb MyDB

More interestingly, Odoo can also create a new database by copying an existing one, using the --template option. For this to work, the copied database can't have open connections to it, so make sure your Odoo instance is stopped and there is no other connection open for it. The command to use looks like this:

$ createdb --template=MyDB MyDB2

In fact, every time we create a database, a template is used. If none is specified, a predefined one called template1 is used.

To list the existing databases in your system, use the...

More server configuration options

The Odoo server supports quite a few other options. We can check all the available options with --help:

$ ~/odoo-dev/odoo/odoo-bin --help

We will review some of the most important options in the following sections. Let's start by looking at how the currently active options can be saved in a configuration file.

Odoo server configuration files

Most of the options can be saved in a configuration file. By default, Odoo will use the .odoorc file. In Linux systems, its default location is in the home directory ($HOME), and in the Windows distribution, it is in the same directory as the executable used to launch Odoo.

In older Odoo/OpenERP versions, the name for the default configuration file...

Installing additional modules

Making new modules available in an Odoo instance so they can be installed is something that newcomers to Odoo frequently find confusing. But it doesn't have to be, so let's get familiar with that.

Finding community modules

There are many Odoo modules available on the internet. The Odoo app store at apps.odoo.com is a catalog of modules that can be downloaded and installed on your system. Another important resource is the Odoo Community Association (OCA) maintained modules, also available on GitHub at https://github.com/OCA/. The OCA is a non-profit organization created to coordinate community contributions, promoting software quality, development best practices, and open source values...

Installing Odoo in a Python virtual environment

It is a common case among Odoo developers to maintain code for several Odoo versions. Some organizational effort is needed to keep these projects alongside each other and working on the same development machine. And, there is some context switching needed when changing from one version to another. For example, the Odoo start executable is now odoo-bin, but in older versions it was odoo.py, and you need to remember that. With the move to Python 3, this can be even more confusing; you need to choose whether to use python / pip or python3 / pip3, depending on the Odoo server version you are working on at that moment.

Python includes virtualenv, a tool to manage independent Python environments on the same machine. Each environment has its own Python executable and installed libraries. You just need to activate the environment...

Technical requirements


This chapter will guide you to install Odoo from source in your development computer. Ideally, we need an Ubuntu 18.04 operating system. A Windows 10 system is also an option, since we will explain how to set up Ubuntu in the Windows Subsystem for Linux.

Some reference code for this chapter can be found in the book's GitHub repository, https://github.com/PacktPublishing/Odoo-12-Development-Essentials-Fourth-Edition, in the ch02/ directory.

Setting up a host for the Odoo server


A Debian/Ubuntu system is recommended to run Odoo servers. While Odoo is multi-platform and can run on a variety of operating systems, it's also true that the Odoo R&D team considers Debian the reference deployment platform. In fact, Odoo's own SaaS operations are known to be Debian-based. It is also the most popular choice in the community. This means that it will be easier to find help or advice if you use Debian or Ubuntu. Even if you're from a Windows background, it will be important that you have some knowledge about it.

You will still be able to work from your favorite desktop system, be it Windows, Mac, or other Linux flavors, such as CentOS.

Note

Keep in mind that these instructions are intended to set up a new system for development. If you want to try some of them in an existing system, always take a backup ahead of time in order to be able to restore it in case something goes wrong.

Installing the Windows Subsystem for Linux

On a Windows system...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Explore Odoo 12 capabilities to develop business applications
  • Program business logic and manipulate data to implement specific business rules in your applications
  • Integrate Python APIs for building customizable and scalable business logic

Description

Odoo is one of the best platforms for open source ERP and CRM. Its latest version, Odoo 12, brings with it new features and updates in Python packages to develop more customizable applications with additional cloud capabilities. The book begins by covering the development essentials for building business applications. You will start your journey by learning how to install and configure Odoo, and then transition from having no specific knowledge of Odoo to being ready for application development. You will develop your first Odoo application and understand topics such as models and views. Odoo 12 Development Essentials will also guide you in using server APIs to add business logic, helping you lay a solid foundation for advanced topics. As you progress through the chapters, you will be equipped to build and customize your applications and explore the new features in Odoo 12, such as cloud integration, to scale your business applications. You will get insights into building business logic and integrating various APIs into your application. By the end of the book, you will be able to build a business application from scratch by using the latest version of Odoo.

Who is this book for?

If you are a developer familiar with Python and MVC design and want to build business applications using Odoo, this book is for you.

What you will learn

  • Manage Odoo server instances
  • Create a new Odoo application from scratch using the most frequently used elements
  • Develop new models and use inheritance to extend existing models
  • Use ORM methods in the Odoo server and from external clients
  • Create Kanban views using QWeb effectively
  • Build custom web and website CMS pages
  • Use external APIs to integrate Odoo with external applications
  • Add automated tests and techniques to debug module business logic

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 28, 2018
Length: 404 pages
Edition : 4th
Language : English
ISBN-13 : 9781789532470
Category :
Languages :
Concepts :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Dec 28, 2018
Length: 404 pages
Edition : 4th
Language : English
ISBN-13 : 9781789532470
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 146.97
Learn Odoo
€41.99
Odoo 12 Development Essentials
€36.99
Odoo 12 Development Cookbook
€67.99
Total 146.97 Stars icon

Table of Contents

16 Chapters
Quick Start Using the Developer Mode Chevron down icon Chevron up icon
Preparing the Development Environment Chevron down icon Chevron up icon
Your First Odoo Application Chevron down icon Chevron up icon
Extending Modules Chevron down icon Chevron up icon
Import, Export, and Module Data Chevron down icon Chevron up icon
Models – Structuring the Application Data Chevron down icon Chevron up icon
Recordsets – Working with Model Data Chevron down icon Chevron up icon
Business Logic – Supporting Business Processes Chevron down icon Chevron up icon
External API – Integrating with Other Systems Chevron down icon Chevron up icon
Backend Views – Designing the User Interface Chevron down icon Chevron up icon
Kanban Views and Client-Side QWeb Chevron down icon Chevron up icon
Reports and Server-Side QWeb Chevron down icon Chevron up icon
Creating Website Frontend Features Chevron down icon Chevron up icon
Deploying and Maintaining Production Instances Chevron down icon Chevron up icon
Assessments Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.4
(5 Ratings)
5 star 80%
4 star 0%
3 star 0%
2 star 20%
1 star 0%
G. Wideman Apr 07, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I post this review after only an initial read and skim. The book doesn't require performing all the step-by-step exercises on an installation of Odoo, but doing so would surely contribute to understanding the material (and trying out related points beyond the book's specifics). I have not done those exercises yet, so can't speak to their detailed accuracy, but since this book has no reviews yet, and books specific to a software version have a short shelf life, I thought I'd post a preliminary review about a crucial aspect of this one.In the past I've found Packt books rather consistently disappointing, shoddy and sometimes outright terrible. Page after page of significant technical and factual errors, incomprehensibly vague word-salad sentences, language translations that looked like they came direct from google translate with no editing, and so on.I want to assure prospective purchasers that this book has none of that. It's written in clear, precise English, for which I commend the author and editors.You can judge from "Look Inside" whether it covers the topics you want to know, and I'll add that in each of those chapters the narrative covers the material in a coherent and comprehensible manner, each topic building to the next. The author goes to some length in sidebar hints and tips to thoughtfully anticipate related points you'll want to know, and also to highlight differences from previous versions.In short, if you have had a previous negative experience with Packt books, you can relax your skepticism for this one.If I have a criticism it would be that while the book has numerous helpful screenshots (of a readable size and competently printed!), it almost completely lacks diagrams; some E-R (or UML) diagrams would have been very useful to further illuminate the models and relationships between them that the narrative discusses. However, this is a shortcoming not at all unique to this book . I would also have liked the book to cover structure and customization of particular modules, such as inventory/products and eCommerce. I suspect that kind of coverage was deliberately outside the scope of the current book, but it would make for a very useful second book, or companion material.That said, "well done" author and team, and I hope that Packt continues with this quality level and better.
Amazon Verified review Amazon
Ignacio Jan 27, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Muchas mejoras en la organización del libro respecto a las precedentes. Incorpora avisos muy útiles sobre las novedades de la versión 12 sin perder de vista las versiones anteriores soportadas por Odoo. Esta edición no es un copia y pega de las anteriores. Ha sido cuidadosamente re elaborada y cubre casi todos los aspectos esenciales para el desarrollador novel (y no tan novel) en Odoo. Libro que merece la compra de las dos ediciones (kindle e impresa) para tener la obra siempre a mano. Felicidades al autor.
Amazon Verified review Amazon
Nelson Ramírez Jan 05, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Even you are an Expert or not, I recommend this book. It's imposible to remember all the development tricks. This is a book that will use many times to have a it as a reinforcement. Love it, proud of having it.
Amazon Verified review Amazon
Greg Mader Oct 27, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Daniel's book solves a huge problem in the Odoo community-- Documentation. Odoo is the greatest platform most have not heard of, and in part, it is due to the lack of books like this. Daniel's efforts in this and other books have made a tremendous difference for a lot of people.
Amazon Verified review Amazon
Rachmat Kosasih Sep 06, 2019
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
I tried to follow the example, but stuck right at the first exercise.In section Adding a field to a form view, it provides the code for the architecture. I got error response from my Odoo dev server right after key in the closing bracket.Found another err:Create new model for library app, loaded ok, however few paragraph below, under section Setting up access security, it showed wrong warning, instead of model library.book, it showed mode todo.task
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.