<data priority="50">
    <xpath expr="//table/tbody/tr[1]" position="replace">
        <!-- Get all invoice types -->
        <t t-set="x_timesheet_invoice_type" t-value="[]"/>
        <t t-foreach="docs" t-as="doc">
            <t t-set="x_timesheet_invoice_type" t-value="x_timesheet_invoice_type+[doc.x_timesheet_invoice_type]"/>
        </t>
        <style>
          td#date {
            white-space: nowrap;
          }
        </style>
        <!-- Foreach timesheet type list entries -->
        <t t-foreach="set(x_timesheet_invoice_type)" t-as="type">
            <tr>
                <td colspan="5">
                    <br/>
                    <p class="lead"><span t-esc="{False: False, 'non_billable': 'Nicht abrechenbare Aufw&#xE4;nde', 'billable_time': 'Abrechenbare Aufw&#xE4;nde'}[type]"/>:</p>
                </td>
            </tr>
            <tr t-foreach="docs" t-as="l">
                <t t-if="type==l.x_timesheet_invoice_type">
                    <td id="date">
                        <span t-field="l.date"/>
                        <br/>
                        <span t-field="l.employee_id.name"/>
                    </td>
                    <td>
                        <span t-field="l.name" t-options="{'widget': 'text'}"/>
                    </td>
                    <td t-if="show_project">
                        <span t-field="l.project_id.name"/>
                    </td>
                    <td t-if="show_task">
                        <t t-if="l.task_id">
                            <span t-field="l.task_id.name"/>
                        </t>
                    </td>
                    <td class="text-right">
                        <span t-field="l.unit_amount" t-options="{'widget': 'duration', 'digital': True, 'unit': 'hour', 'round': 'minute'}"/>
                    </td>
                </t>
            </tr>
            <tr>
                <td/>
                <td t-if="show_project"/>
                <td t-if="show_task"/>
                <td class="text-right">
                    <strong>Zwischensumme</strong>
                </td>
                <td class="text-right">
                    <strong t-esc="sum(docs.filtered(lambda l: type==l.timesheet_invoice_type).mapped('unit_amount'))" t-options="{'widget': 'duration', 'digital': True, 'unit': 'hour', 'round': 'minute'}"/>
                </td>
            </tr>
        </t>
    </xpath>
</data>
