Creating QWeb-based PDF reports
When communicating with the outside world, it is often necessary to produce a PDF document from a record in the database. Odoo uses the same template language as that used for form views: QWeb.
In this recipe, we will create a QWeb report to print information about a book that is currently being borrowed by a partner. This recipe will reuse the models presented in the Adding a progress bar in kanban views recipe from earlier on in this chapter.
Getting ready
If you haven't done so already, install wkhtmltopdf
as described in Chapter 1, Installing the Odoo Development Environment; otherwise, you won't get shiny PDFs as a result of your efforts.
Also, double-check that the web.base.url
configuration parameter (or, alternatively, report.url
) is a URL that is accessible from your Odoo instance; otherwise, the report will take a long time to generate and the result will look strange.
How to do it...
- In this recipe, we will...