Creating an OWL component
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_library
module with basic fields and views. You will find the basic my_library
module in the Chapter16/00_initial_module
directory in the GitHub repository.
How to do it...
We will add a small horizontal bar component to the Odoo web client. Perform the following steps to add your first component to the Odoo web client:
- Add a
/my_library/static/src/js/component.js
JavaScript file and define the new module's namespace:odoo.define('my.component', function (require) { "use strict"; // Place steps 3, 4, 5 here });
- Add the
/my_library/views/templates.xml
XML file and load the component JavaScript...