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
$27.98 $39.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
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
Estimated delivery fee Deliver to Egypt

Standard delivery 10 - 13 business days

$12.95

Premium delivery 3 - 6 business days

$34.95
(Includes tracking information)

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 Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Egypt

Standard delivery 10 - 13 business days

$12.95

Premium delivery 3 - 6 business days

$34.95
(Includes tracking information)

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
$19.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
$199.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
$279.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 $ 193.97
Learn Odoo
$54.99
Odoo 12 Development Essentials
$48.99
Odoo 12 Development Cookbook
$89.99
Total $ 193.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 the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela