December 2018
Beginner to intermediate
404 pages
10h 14m
English
Now that we have gone through the basics, let's work on our checkout list. We want to have a /checkout URL that shows us a web page with a list of checkouts.
For that, we need a controller method to prepare the data to present and a QWeb template to present it to the user.
Add the library_website/controllers/main.py file to the module, with the following code:
from odoo import http from odoo.http import request class Main(http.Controller): @http.route('/checkouts', auth='user', website=True)
def checkouts(self, **kwargs):
Checkout = request.env['library.checkout']
checkouts = Checkout.search([])
return request.render(
'library_website.index', {'docs': checkouts})
The controller retrieves the data to be used ...
Read now
Unlock full access