Creating or modifying templates – QWeb
We'll add website capabilities to the my_library
add-on developed in Chapter 4, Application Models. What we're interested in is allowing users to browse through the library and, if they are logged in with the appropriate permissions, enabling them to edit book details right from the website interface.
Getting ready
For this recipe, we will be using my_library
from the https://github.com/PacktPublishing/Odoo-14-Development-Cookbook-Fourth-Edition/tree/master/Chapter14/00_initial_module/my_library directory from the GitHub repository of this book.
How to do it...
We'll need to define the following couple of controllers and views:
- Add a controller that serves the list of books in
controllers/main.py
, as follows:from odoo import http from odoo.http import request class Main(http.Controller): @http.route('/books', type='http', auth="user", website...