The form page

We can start by implementing the controller method to support the form rendering, in the todo_website/controllers/main.py file:

@http.route('/todo/add', auth="user", website=True) 
def add(self, **kwargs): 
    users = request.env['res.users'].search([]) 
    return request.render( 
        'todo_website.add', {'users': users}) 

This is a simple controller, rendering the todo_website.add template, and provides it with a list of users so that they can be used to build a selection box.

The corresponding QWeb template can be added to the todo_website/views/todo_web.xml data file:

<template id="add" name="Add Todo Task"> <t t-call="website.layout"> <t t-set="additional_title">Add Todo</t> <div id="wrap" class="container"> <div class="row"> <section ...

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.