Odoo 12 Development Cookbook - Third Edition
by Parth Gajjar, Alexandre Fayolle, Holger Brunn, Daniel Reis
How it works...
In the first step, we have imported a few required functions. The slug is used to generate a clean, user-friendly URL, based on a record name. The sitemap_qs2dom is used to generate a domain based on route and query strings.
In step 2, we have created a Python generator function sitemap_books(). This function will be called whenever a sitemap is generated. During the call, it will receive three arguments—the env Odoo environment, the rule route rule, and the qs query string. In the function, we have generated a domain with sitemap_qs2dom. Then, we used the generated domain to search the book records, which are used to generate the location through the slug() method. With slug, you will get a user-friendly URL, like /books/odoo-12-development-cookbook-1 ...
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