Skip to content

Instantly share code, notes, and snippets.

@CakJuice
Created May 24, 2019 06:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save CakJuice/7bfdee10024ef36c0fcbb1cc03aacbf7 to your computer and use it in GitHub Desktop.
Save CakJuice/7bfdee10024ef36c0fcbb1cc03aacbf7 to your computer and use it in GitHub Desktop.
Odoo 12 custom report template
<odoo>
<record model="report.paperformat" id="paperformat_attendance_recap_report">
<field name="name">paperformat.attendance.recap.report</field>
<field name="default" eval="True"/>
<field name="format">A4</field>
<field name="page_width">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">30</field>
<field name="margin_right">5</field>
<field name="margin_bottom">10</field>
<field name="margin_left">5</field>
<field name="header_line" eval="False"/>
<field name="header_spacing">20</field>
<field name="dpi">90</field>
</record>
<report id="recap_report"
model="attendance.recap.report.wizard"
string="Attendance Recap Report"
report_type="qweb-pdf"
name="cj_custom_report_v12.attendance_recap_report_view"
paperformat="paperformat_attendance_recap_report"
menu="False"/>
<template id="attendance_recap_report_view">
<t t-call="web.html_container">
<div class="header" style="border-bottom: 2px solid black">
<h3 class="text-center">Attendance Recap Report</h3>
<h4 class="text-center">
<strong>From</strong>:
<t t-esc="date_start"/>
<strong>To</strong>:
<t t-esc="date_end"/>
</h4>
</div>
<div class="article">
<table class="table table-condensed table-bordered" style="width: 100%">
<thead>
<th class="text-center" style="width: 70%">Employee</th>
<th class="text-center" style="width: 15%">Presence</th>
<th class="text-center" style="width: 15%">Absence</th>
</thead>
<tbody>
<t t-foreach="docs" t-as="doc">
<tr>
<td>
<span t-esc="doc['employee']"/>
</td>
<td class="text-center">
<span t-esc="doc['presence']"/>
</td>
<td class="text-center">
<span t-esc="doc['absence']"/>
</td>
</tr>
</t>
</tbody>
</table>
</div>
<div class="footer">
<div class="row text-center" style="border-top: 1px solid black;">
<div class="col col-3 offset-9 text-right">
<ul class="list-inline mt-2">
<li class="list-inline-item">Page:</li>
<li class="list-inline-item">
<span class="page"/>
</li>
<li class="list-inline-item">/</li>
<li class="list-inline-item">
<span class="topage"/>
</li>
</ul>
</div>
</div>
</div>
</t>
</template>
</odoo>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment