over 9 years ago
There are some specific variables accessible to make template reports.
1. docs : records for the current report
2. doc_ids : list of ids for the docs records
3. doc_model : model for the docs records
4. time : a reference to time from the Python standard library
5. user : res.user record for the user printing the report
6. res_company : record for the current user's company
For example see below code
- <template id="report_invoice">
- <t t-call="report.html_container">
- <t t-foreach="docs" t-as="o">
- <t t-call="report.external_layout">
- <div class="page">
- <h2>Report title</h2>
- This object's name is <span t-field="o.name"></span>
- </div>
- </t>
- </t>
- </t>
- </template>
<template id="report_invoice"> <t t-call="report.html_container"> <t t-foreach="docs" t-as="o"> <t t-call="report.external_layout"> <div class="page"> <h2>Report title</h2> This object's name is <span t-field="o.name"></span> </div> </t> </t> </t> </template>
Note- If you wish to access other records/models in the template, you will need a custom report.
0 Comment(s)