Skip to Content
Menu
This question has been flagged

i need to print a time sheet report for each employee,and i need to display the employee name at the header not on the column cells because it will be repeated in every row and i don't need that

i tried to use < t-foreach > but it display the name to much

i need it to display the employee_id at the header or at the first column i the first row only without being repeated

     <template id="19011.employee">
         <t t-call="web.html_container"> <t t-call="web.external_layout"> <div class="page"> <div class="text-center"> <h2> <strong>TIME SHEET</strong> </h2> <h2> <tr t-foreach="docs" t-as="o"> <span t-field="o.employee_id"/> </tr> </h2> </div> <table class="table table-condensed" bgcolor="#875A7B"> <tr> <th> check in</th> <th> check out</th> <th> Total</th> </tr> <tr t-foreach="docs" t-as="o"> <td> <t t-esc="o.check_in" /> </td> <td> <t t-esc="o.check_out" /> </td> <td> <t t-esc="o.total" /> </td> </tr> <tr bgcolor="#875A7B"> <td align="center"> <strong> Total Hours</strong></td> <td></td> <td> <strong t-esc="sum([o.total for o in docs])"/> </td> </tr> </table> </div> </t> </t> </template>

Avatar
Discard
Best Answer

Hi! Like this?


<template id="19011.employee">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<tr t-foreach="docs" t-as="o">
<div class="text-center">
<h2>
<strong>TIME SHEET</strong>
</h2>
<h2>
<span t-field="o.employee_id"/>
</h2>
</div>
<table class="table table-condensed" bgcolor="#875A7B">
<tr>
<th>check in</th>
<th>check out</th>
<th>Total</th>
</tr>
<tr>
<td>
<t t-esc="o.check_in"/>
</td>
<td>
<t t-esc="o.check_out"/>
</td>
<td>
<t t-esc="o.total"/>
</td>
</tr>
<tr bgcolor="#875A7B">
<td align="center">
<strong>Total Hours</strong>
</td>
<td></td>
<td>
<strong t-esc="sum([o.total for o in docs])"/>
</td>
</tr>
</table>
</tr>
</div>
</t>
</t>
</template>
Avatar
Discard
Related Posts Replies Views Activity
7
Apr 23
26604
2
Oct 22
4549
2
Mar 21
2503
2
Mar 21
7223
0
Dec 20
2689