To provide our first web page, we will add a controller object. We will begin by having this file imported with the module:
- First, add a todo_website/__init__.py file with the following line:
from . import controllers
- Then, add a todo_website/controllers/__init__.py file with the following line:
from . import main
- Now, add the actual file for the controller, todo_website/controllers/main.py, with the following code:
from odoo import http class Todo(http.Controller): @http.route('/helloworld', auth='public') def hello_world(self): return('<h1>Hello World!</h1>')
The odoo.http module provides the Odoo web-related features. Our controllers, responsible for page rendering, should be objects inheriting from the odoo.http.Controller ...