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

Working with the ORM API


From the previous section, we already got a taste of what it is like to use the ORM API. Next we will look at what more we can do with it.

The shell command

Python has a command-line interface that is a great way to explore its syntax. Similarly, Odoo also has an equivalent feature, where we can interactively try out commands to see how they work. That is the shell command.

To use it, run Odoo with the shell command and the database to be used, as shown here:

$ ./odoo-bin shell -d todo

You should see the usual server start up sequence in the terminal until it stops on a >>> Python prompt waiting for your input. Here, self will represent the record for the Administrator user, as you can confirm by typing the following:

>>> self
res.users(1,)
>>> self._name
'res.users'
>>> self.name
'Administrator'

In the shell session here, we inspected our environment. The self represents a res.users recordset containing only the record with the ID 1...