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
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Odoo 11 Development Essentials

You're reading from   Odoo 11 Development Essentials Develop and customize business applications with Odoo 11

Arrow left icon
Product type Paperback
Published in Mar 2018
Publisher Packt
ISBN-13 9781788477796
Length 336 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Daniel Reis Daniel Reis
Author Profile Icon Daniel Reis
Daniel Reis
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Quick Start – The Odoo Developer Mode and Concepts FREE CHAPTER 2. Installing and Organizing the Development Environment 3. Your First Odoo Application – A Practical Overview 4. Models – Structuring the Application Data 5. Import, Export, and Module Data 6. The ORM API – Handling Application Data 7. Business Logic – Supporting Business Processes 8. External API – Integrating with Other Systems 9. Backend Views – Design the User Interface 10. Kanban Views and Client-Side QWeb 11. Reports and Server-Side QWeb 12. Creating Website Frontend Features 13. Debugging and Automated Tests 14. Deploying and Maintaining Production Instances 15. Other Books You May Enjoy

Introducing the Library project

To explain the developer tools, we will use a simple project: we will create a very simple Library app. Our Library aims to keep a record of our Books and their Authors. It should keep a list of the Authors and the Books authored by each Author.

Our Library app needs two Models: Authors and Books. These two Models have a many-to-many relationship between them: each Author can have many Books, and each Book can have many Authors.

Odoo already provides the built-in Partner Model, with the res.partner technical name, to represent people, organizations, and addresses. For example, customers, suppliers, contact people, and application users are all Partners.

We will make our life simpler if we reuse it for the Authors of our Library app. We will be adding an Is Book Author? flag to this Model, and a menu item showing only the Author Partners.

The book we will create has a completely new Model, the corresponding form, and list views, and a menu item to access them.

Creating a work database

We will be needing an Odoo test database to work with.

In Chapter 2, Installing and Organizing the Development Environment, we will explain how to install Odoo from source and set up our development environment. But we want to skip that for now, and start working directly from the user interface of some existing Odoo server.

If by chance you have a self-hosted Odoo installation working, that's perfect; we can use it to go through the rest of this chapter. At the login screen, access the Manage Databases menu option and create a new database to play with.

If you don't have an Odoo installation available, you can instead create a test database at Odoo.com to follow this chapter. The user interface there will be from the Odoo Enterprise Edition, so it will be a little different from the screenshots you will find here, but that should not be a problem. To create a new database, you will probably be asked to select a starting app. No specific app is required to follow this chapter, but if you're unsure on what to pick, CRM would be fine.

Odoo follows an "open core" business model, where the product is published in two editions, Community and Enterprise. The Enterprise edition is built on top of the Community edition, adding some premium features to it, including an improved user interface. At Odoo.com, you will be using the Enterprise edition, and in the public GitHub repository, you will find the Community edition. While the user interface looks different in both editions, they are just cosmetic changes; the user interface features are the same in both editions.

Now, access the Odoo database with your browser and log in. For Odoo online, the address should be something like https://<mydbname>.odoo.com. For a self-hosted instance, it should be something like http://<server-address>:8069. The 8069 port is the Odoo default. If your installation uses a different port, you should change it accordingly.

We will be using the Contacts Directory app, so the first thing to do is to install it. Open the Apps top menu, look up this app, and install it, if you have not already done so:

Now that we have an Odoo instance to work with, the next step is to enable the developer tools, that give us the access to the Odoo internals.

Enabling the developer tools

In Settings | Dashboard, at the bottom right, you can find the Activate the developer mode link. Clicking on it enables the Developer mode features for this browser window.

For Odoo 9.0 and before, the Developer mode is activated in the About dialog window, available from the User menu, at the top-right corner of the web client. 

We also have available an Activate the developer mode (with assets) option. What it does is to prevent web client asset minification. It is useful to debug the web client itself, at the expense of making the navigation a little slower.

For faster load times, the web client minifies the Javascript and CSS assets into compact files. Unfortunately, that makes web client debugging nearly impossible. The Activate the developer mode (with assets) option prevents this minification and loads the web assets in individual, non-minified files.

You can enable the Developer mode without having to leave your current screen to open settings. Just edit the current URL to insert ?debug, or ?debug=assets, just after the /web part.
For example, http://myserver/web#home would be changed to http://myserver/web?debug#home.
Although there is no link to enable it, the frontend framework also supports the debug flag. To disable asset minification in a frontend web page, add ?debug=assets to the corresponding URL. Take note that the option will probably not persist when navigating through links to other frontend pages.

Once the Developer mode is enabled, we will see two additional menus available:

  • The Debug menu, the bug icon at the right-hand side of the top menu bar, just before the username and avatar
  • The Technical menu item, in the Settings app:
The Developer mode also enables additional information on form fields: when pausing the mouse pointer over a field, a tooltip will display technical information on it.

We will be explaining and making use of these Developer mode features in the next sections of this chapter.

You have been reading a chapter from
Odoo 11 Development Essentials - Third Edition
Published in: Mar 2018
Publisher: Packt
ISBN-13: 9781788477796
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image