Step 8 – Implementing the website UI
Odoo also provides a web development framework, to develop website features closely integrated with the backend apps. We will take our first steps toward this by creating a simple web page to display a list of active books in our library.
The book catalog page will respond to web requests at the http://my-server/library/books
address, so /library/books
is the URL endpoint we want to implement.
Web controllers are the components responsible for rendering web pages. A controller is a Python method in an http.Controller
derived class. The method is bound to one or more URL endpoints using the @http.route
controller. When any of these URL endpoints are accessed, the controller code executes and returns the HTML to be presented to the user. The HTML rendering will usually be done using the QWeb templating engine.
Adding the endpoint controller
Code for controllers is expected to be inside a /controllers
subdirectory. To add a controller...