Book Image

Odoo 11 Development Essentials - Third Edition

By : Daniel Reis
Book Image

Odoo 11 Development Essentials - Third Edition

By: Daniel Reis

Overview of this book

Odoo continues to gain worldwide momentum as the best platform for open source ERP installations. Now, with Odoo 11, you have access to an improved GUI, performance optimization, integrated in-app purchase features, and a fast-growing community to help transform and modernize your business. With this practical guide, you will cover all the new features that Odoo 11 has to offer to build and customize business applications, focusing on the publicly available community edition. We begin with setting up a development environment, and as you make your way through the chapters, you will learn to build feature-rich business applications. With the aim of jump-starting your Odoo proficiency level, from no specific knowledge to application development readiness, you will develop your first Odoo application. We then move on to topics such as models and views, and understand how to use server APIs to add business logic, helping to lay a solid foundation for advanced topics. The book concludes with Odoo interactions and how to use the Odoo API from other programs, all of which will enable you to efficiently integrate applications with other external systems.
Table of Contents (20 chapters)
Title Page
Packt Upsell
Contributors
Preface
Index

Preface

Odoo is a full featured open source platform to build applications. Based on this core framework, a suite of integrated applications was built, covering all business areas from CRM and Sales to Stocks and Accounting.

Beyond these out-of-the-box features, Odoo's framework was built with extensibility in mind. Extensions and modifications can be implemented as modules, to be applied over the module with the feature being changed, without actually changing it. This provides a clean and easy -to-control and customized applications.

This capability to combine several modules into feature-rich applications, along with the open source nature of Odoo, are probably important factors explaining the community that grew around Odoo. In fact, there are thousands of community modules available for Odoo, covering virtually every topic, and the number of people getting involved has been steadily growing every year.

Odoo 11 Development Essentials provides a step-by-step guide to Odoo development, allowing readers to quickly climb the learning curve and become productive in the Odoo application platform. At the same time, it tries to provide good reference materials, to be kept nearby every time you are working with Odoo.

Who this book is for

This book was written keeping in mind developers with minimal programming knowledge but a strong will to learn. We will use a lot the Python language and explain how to run Odoo in a Ubuntu/Debian system, but little previous knowledge on them is assumed. The code examples are kept simple and clear, and they are accompanied with appropriate explanations to help build up the knowledge on them.

Experienced developers, already familiar with Odoo, should also be able to benefit from this book. Not only does it allow them to consolidate their knowledge, it also provides an easy way to get up to date with all the details that changed with Odoo 11.0. In fact, special care was taken to highlight all the relevant changes between Odoo versions since 8.0.

Finally, this book should provide a solid reference to be used daily, both by newcomers and experienced developers. The documentation of the relevant differences between the several Odoo versions should also be a good resource for any developer working with different Odoo versions at the same time or porting modules to other versions.

What this book covers

This books contains 14 chapters, which can be seen to be organized in five parts, roughly, introduction, models, business logic, views, and deployment.

The first part introduces the Odoo framework, explains how to set up your development environment and provides a tutorial with thorough, step-by-step creation of a new Odoo module:

Chapter 1, Quick Start – The Odoo Developer Mode and Concepts, visually introduces the Odoo development concepts, creating a simple Odoo application directly from the user interface. An existing Odoo installation, or an Odoo.com instance, can be used, so no local setup is needed.

Chapter 2, Installing and Organizing the Development Environment, explains how to install Odoo from source and how to set up the development environment to be used throughout the book. We choose to install Odoo in an Ubuntu host, but guidance is given to have a perfectly functioning development environment in a Windows machine with an Ubuntu virtual machine.

Chapter 3, Your First Odoo Application – A Practical Overview, provides a step-by-step guide through the creation of our first Odoo module. While the example is kept simple, it covers all the different layers and components that can be involved in an Odoo application: models, business logic, backend views, and web frontend views.

The second part of the book introduces Models, responsible for the data model structures around which the application is built:

Chapter 4, Models – Structuring the Application Data, discusses the Model layer in detail, introducing the framework's Object-Relational Mapping (ORM), the different types of models available, and the field types, including relational and computed fields.

Chapter 5, Import, Export, and Module Data, covers the most used Odoo data file formats—XML and CSV—the external identifier concept, how use to data file in modules, and data import/export operations.

In the third part, we explain how to write the business logic layer on top of the Models—the "Controller "component of the architecture:

Chapter 6, The ORM API – Handling Application Data, goes further into the ORM, explaining how it can be used to manipulate the data in the Models. The API for social features, such as followers and notifications, is also explained.

Chapter 7, Business Logic – Supporting Business Processes, explains how to program business logic on the server side, leveraging the ORM concepts and features. It also explains how to use wizards for a more sophisticated user interaction.

Chapter 8, External API – Integrating with Other Systems, shows how to implement Odoo external applications by implementing a command-line client that interacts with our Odoo server. There are several alternative client programming libraries available, which are introduced and used to implement our showcase client utility.

The fourth part explores the "View" layer and the several technologies that can be used for that layer:

Chapter 9, Backend Views – Design the User Interface, covers the web client's View layer, explaining the several types of views in detail and all the elements that can be used to create dynamic and intuitive user interfaces.

Chapter 10, Kanban Views and Client-Side QWeb, keeps working with the web client, but introduces Kanban views and explains the QWeb templates used to design the Kanban board elements.

Chapter 11, Reports and Server-Side QWeb, discusses using the QWeb-based report engine and everything needed to generate printer-friendly PDF reports.

Chapter 12, Creating Website Frontend Features, introduces Odoo website development, including web controller implementations and using QWeb templates to build frontend web pages.

Finally, the fifth part covers deployment and maintenance practices. Some special considerations, not relevant for development environments, need to be taken into account when deploying for production use.

Chapter 13, Debugging and Automated Tests, shares some debugging techniques to be used when developing Odoo modules. How to implement automated tests is also explained, since this is an essential practice to produce reliable code.

Chapter 14, Deploying and Maintaining Production Instances, shows us how to prepare a server for production prime time, explaining what configuration should be taken care of and how to configure an Nginx reverse proxy for improved security and scalability.

At the end of the book, the reader should have a solid understanding of all the steps and components involved in the Odoo application development cycle, from the drawing board to production deployment and maintenance of these applications.

To get the most out of this book

Other than being familiar with programming, no particular knowledge is expected to be able to take advantage of this book.

Odoo is built using the Python programming language, so it is a good idea to get solid knowledge of it. We also choose to run Odoo in an Ubuntu host, and will do some work on the command line, so it will help to be familiar with it.

To get the most out of this book, we recommend that you find complementary readings on the Python programming language, Ubuntu/Debian Linux operating system, and the PostgreSQL database.

While we will run Odoo in an Ubuntu host (a popular cloud hosting option), we will provide guidance on how to set up our development environment in a Windows system with the help of VirtualBox. Of course, working from an Ubuntu/Debian system is also a possible choice.

All the required software is freely available, and the instructions on where to find it will be given.

Download the example code files

You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support 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 www.packtpub.com.
  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 latest version 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 athttps://github.com/PacktPublishing/Odoo-11-Development-Essentials-Third-Edition. We also have other code bundles from our rich catalog of books and videos available athttps://github.com/PacktPublishing/. Check them out!

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: "We will have a new /todo_app directory alongside the /odoo directory containing the modules."

A block of code is set as follows:

<?xml version="1.0"?> 
<odoo> 
  <!-- Content will go here... --> 
</odoo> 

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

  'data': [
    'security/ir.model.access.csv',
    'views/todo_menu.xml',
    'views/todo_view.xml',
    ]

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

$ createdb MyDB
$ createdb --template=MyDB MyDB2

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: "In the web client, access the Apps top menu and select the Update Apps List menu option."

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email [email protected] and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packtpub.com.