QWeb report templates

The reports will usually follow a basic skeleton, as shown in the following code. This can be added to the reports/todo_report.xml file, just after the <report> element:

<template id="report_todo_task_template"> 
  <t t-call="web.html_container">
    <t t-call="web.external_layout">
      <div class="page">        <!-- Report header content -->        <t t-foreach="docs" t-as="o"> 
          <!-- Report row content -->         </t>        <!-- Report footer content -->      </div>
    </t>
  </t>
</template>

The most important elements here are the t-call directives using standard report structures. The web.html_container template does the basic setup to support an HTML document. The web.external_layout template handles the report header and footer, using the corresponding setup ...

Get Odoo 11 Development Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.