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 that’s used for form views: QWeb.
In this recipe, we will create a QWeb report to print information about a room that is currently being borrowed by a student. This recipe will reuse the models presented in the Adding a progress bar in Kanban views recipe from earlier 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 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...
Follow these steps:
- In this...