Creating an OWL component
The main building blocks of OWL are components and templates.
In OWL, every part of the UI is managed by a component: they hold the logic and define the templates that are used to render the user interface
The goal of this recipe is to learn the basics of an OWL component. We will create a minimal OWL component and append it to the Odoo web client. In this recipe, we will create a component for a small horizontal bar with some text.
Getting ready
For this recipe, we will be using the my_hostel
module with basic fields and views. You will find the basic my_hostel
module in the https://github.com/PacktPublishing/Odoo-17-Development-Cookbook-Fifth-Edition/tree/main/Chapter16/00_initial_module/my_hostel directory in the GitHub repository.
How to do it...
We will add a small horizontal bar component to the Odoo web client. Follow these steps to add your first component to the Odoo web client:
- Add a
my_hostel/static/src/js/component.js...