Odoo is a fully-featured open source platform for building 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.Modifications can be implemented as extension modules, to be applied as a layer on top on the existing modules being changed, without actually changing the original code.
This provides a clean and easy-to-control customization approach.
This capability to combine several modules into feature-rich applications, along with the open source nature of Odoo, are probably important factors in the growth of the community 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 12 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 close to hand every time you are working with Odoo.
Experienced developers who are already familiar with Odoo should also benefit from this book.Not only does it allow them to consolidate their knowledge, but it also provides an easy way to get up to date with all the details that changed with Odoo 12.0.In fact, special care was taken to highlight all the relevant changes between the different 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 who is porting modules to other versions.
This books contains 14 chapters, organized into five parts: introduction, models, business logic, views, and deployment.
Chapter 2, Preparing the Development Environment, explains how to install Odoo from source code and how to set up the development environment to be used throughout the book.We choose to install Odoo in an Ubuntu environment, and, with Windows 10, we can use the Windows Subsystem for Linux (WSL) to achieve this.
Chapter 3, Your First Odoo Application, provides a step-by-step guide to the creation of our first Odoo module, a book catalog for a Library app.While the example is 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.
Chapter 4, Extending Modules, explains the available inheritance mechanisms and how to use them to create extension modules, adding or modifying features from other existing add-on modules.
The second part of the book introduces the models responsible for the data model structures around which the application is built: Chapter 5, Import, Export, and Module Data, addresses the usage of data files in Odoo and their role in modules to load data and configurations to the database.It covers the XML and CSV data file formats, the external identifier concept, how to use data file in modules, and data import/export operations.
Chapter 6, 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.
In the third part, we explain how to write the business logic layer on top of the models—the controller component of the architecture.This includes the built-in ORM functions, used to manipulate the data in the models, and social features used for messages and notifications: Chapter 7, Recordsets – Working with Model Data, introduces the concepts and features of ORMs, how to query and ready to read data from models, how to manipulate recordsets, and how to write changes on model data.
Chapter 8, Business Logic – Supporting Business Processes, explores programming business logic on the server side to manipulate data and implement specific business rules.It also explains how to use wizards for more sophisticated user interaction.The built-in social features, messages, chatter, followers, and channels, are addressed, as well as testing and debugging techniques.
Chapter 9, External API – Integrating with Other Systems, shows how to implement external Odoo 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 the user interface: Chapter 10, 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 11, 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 12, Reports and Server-Side QWeb, discusses using the QWeb-based report engine and everything needed to generate printer-friendly PDF reports.
Chapter 13, Creating Website Frontend Features, introduces Odoo website development, including web controller implementations and using QWeb templates to build frontend web pages.
By 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 the production, deployment, and maintenance of these applications.
Odoo is built using the Python programming language, so it is a good idea to have a good 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 do some complementary reading on the Python programming language, the 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 using the Windows for Linux Subsystem (WSL), available in recent Windows 10 builds.Of course, working from an Ubuntu/Debian native system is also a good choice.
All the required software is freely available, and the instructions on where to find it will be given.
You can download the example code files for this book from your account at www.packt.com.If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps: Log in or register at www.packt.com.1.
Select the SUPPORT tab.2.
Click on Code Downloads & Errata.3.
Enter the name of the book in the Search box and follow the onscreen4.
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 at https://github.com/PacktPublishing/Odoo-12-Development-Essentials-Fourth-Editio n. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/.Check them out!
We also provide a PDF file that has color images of the screenshots/diagrams used in this book.You can download it here: https://www.packtpub.com/sites/default/files/ downloads/9781789532470_ColorImages.pdf.
There are a number of text conventions used throughout this book.
Tips and tricks appear like this.
Feedback from our readers is always welcome.
General feedback: Email firstname.lastname@example.org 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@example.com.
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.packt.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 firstname.lastname@example.org 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.packt.com.
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 packt.com.
Finally, the fifth part covers deployment and maintenance practices.Some special considerations, not relevant to development environments, need to be taken into account when deploying for production use: Chapter 14, Deploying and Maintaining Production Instances, shows us how to prepare a server for production use, explaining what configuration should be taken care of and how to configure an NGINX reverse proxy for improved security and scalability.
This book was written for developers with minimal programming knowledge but a strong will to learn.We will often use the Python language and explain how to run Odoo in an Ubuntu/Debian system, but little previous knowledge of them is assumed.The code examples are kept simple and clear, and they are accompanied by appropriate explanations.
The first part introduces the Odoo framework, explains how to set up your development environment, and provides a tutorial including a thorough, step-by-step creation of a new Odoo module: Chapter 1, Quick Start Using the Developer Mode, visually introduces the Odoo development concepts by walking through the creation of an Odoo application directly from the user interface, a simple to-do tracking application.Instructions are given to set up Odoo in our workstation, but an existing Odoo installation, or an Odoo.com instance, can be used, so no local setup is required.
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: "The ~ symbol is a shortcut for the user's home directory, such as /home/daniel."A block of code is set as follows: string="Not Done" domain="[('x_is_done', '=', False)]" /> When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold: string="Not Done" domain="[('x_is_done', '=', False)]" /> 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 on screen.For example, words in menus or dialog boxes appear in the text like this.Here is an example: "Click on the debug icon and select the Edit Action option.This will open the Window Actions used to open the current Views."Warnings or important notes appear like this.