Odoo 12 Development Cookbook - Third Edition
by Parth Gajjar, Alexandre Fayolle, Holger Brunn, Daniel Reis
How it works...
In the first step, we created a dynamic route for the book details page. In this route, we have added <model("library.book"):book>. This accepts URLs with integers, like /books/1. Odoo considers this integer as the ID of the library.book model, and when this URL is accessed, Odoo fetches a recordset and passes it to the function as the argument. So, when /books/1 is accessed from the browser, the book parameter in the function library_book_detail() will have a recordset of the library.book model with the ID 1. We passed this book recordset and rendered a new template called my_library.book_detail.
In the second step, we created a new QWeb template called book_detail to render a book details page. This is simple and is created ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access