Extending web features

Extensibility is something we expect in all features of Odoo, and the web features are no exception. We can even extend existing controllers and templates. As an example, we will extend our Hello World web page so that it takes a parameter with the name to greet. For example, using the URL /hello?name=Brian would return a Hello Brian! greeting.

Extending is usually done from a different addon module, but it works just as well inside the same addon. To keep things concise and simple, we'll do it without creating a new addon module.

Let's add a new todo_website/controllers/extend.py file with the following code:

from odoo import http from odoo.addons.todo_website.controllers.main import Todo class TodoExtended(Todo): ...

Get Odoo 11 Development Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.