[ADD]helpdesk_portal_timesheet
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Template to display the timesheet table on the portal -->
|
||||
<template id="portal_timesheet_table" name="Portal Timesheet Table">
|
||||
<table class="o_portal_my_doc_table table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Employee</th>
|
||||
<th>Description</th>
|
||||
<th t-if="is_uom_day" class="text-end">Days Spent</th>
|
||||
<th t-else="" class="text-end">Hours Spent</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr t-foreach="timesheets" t-as="timesheet">
|
||||
<td><t t-esc="timesheet.date" t-options='{"widget": "date"}'/></td>
|
||||
<td t-attf-title="#{timesheet.employee_id.name}"><t t-esc="timesheet.employee_id.name"/></td>
|
||||
<td><t t-esc="timesheet.name"/></td>
|
||||
<td class="text-end">
|
||||
<span t-if="is_uom_day" t-esc="timesheet._get_timesheet_time_day()" t-options='{"widget": "timesheet_uom"}'/>
|
||||
<span t-else="" t-field="timesheet.unit_amount" t-options='{"widget": "float_time"}'/>
|
||||
</td>
|
||||
</tr>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="3"></th>
|
||||
<th class="text-end">
|
||||
<t t-set="timesheets_amount" t-value="round(sum(timesheets.mapped('unit_amount')), 2) or 0.0"></t>
|
||||
<div t-if="is_uom_day"><strong>Days Spent:</strong> <span t-esc="timesheets._convert_hours_to_days(timesheets_amount)" t-options='{"widget": "timesheet_uom"}'/></div>
|
||||
<div t-else=""><strong>Hours Spent:</strong> <span t-esc="timesheets_amount" t-options='{"widget": "float_time"}'/></div>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</template>
|
||||
<!-- Inheritance to display timesheets on the ticket portal page -->
|
||||
<template id="portal_helpdesk_ticket_page_inherit_timesheet" inherit_id="helpdesk_mgmt.portal_helpdesk_ticket_page" name="Ticket Portal Template with Timesheets">
|
||||
<xpath expr="//t[@t-set='card_body']" position="inside">
|
||||
<div class="container mt-4" t-if="ticket.timesheet_ids">
|
||||
<hr class="mt-4 mb-1"/>
|
||||
<h5 id="ticket_timesheets" class="mt-2 mb-2" data-anchor="true">Timesheets</h5>
|
||||
<t t-set="timesheets" t-value="ticket.timesheet_ids"/>
|
||||
<t t-set="is_uom_day" t-value="timesheets._is_timesheet_encode_uom_day()"/>
|
||||
<t t-call="helpdesk_portal_timesheet.portal_timesheet_table"/>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
Reference in New Issue
Block a user