[IMP] hr_timesheet: hide the "Timesheet Timer" feature in the project form if encoding unit is not Hours [IMP] hr_timesheet: clean display of Days for timesheets A computed field has to be added to retrieve the encoding uom of the current company and be used in the views. FieldTimesheetFactor field has to be registered to "float_factor" widget for the "planned_hours" field to work correctly with Days (for the conversion from hours to days to be computed and to be able to set a greater value than 1 day) If encoding unit for timesheets is set to Days: - Display Days instead of Hours in Portal > Timesheets - Display Days instead of Hours in Portal > Tasks - Display Days instead of Hours in Portal > Invoices & Bills - Display Days instead of Hours in Portal > Tickets [IMP] hr_timesheet: display clean duration in Timesheet Entries Display Days instead of Hours in Timesheet Entries (print action) if encoding unit for timesheets is set to Days [IMP] hr_timesheet: correctly display timesheets in Days if configured to - correctly display remaining days in project.task kanban and list view - hide timer start button if timesheet is configured in Days - update several column names [IMP] hr_timesheet: clean code [IMP] hr_timesheet: small improvements when displaying timesheets in days - Rename some labels - Fixes style - Prevent fields displayed with widget "timesheet_uom" to change when timer is on - Display correctly "Initially Planned Days" field in task creation form
81 lines
3.7 KiB
XML
81 lines
3.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
|
|
<template id="portal_my_task" inherit_id="project.portal_my_task" name="Portal: My Task with Timesheets">
|
|
<xpath expr="//t[@t-set='card_body']" position="inside">
|
|
<div class="container" t-if="timesheets">
|
|
<hr class="mt-4 mb-1"/>
|
|
<h5 class="mt-2 mb-2">Timesheets</h5>
|
|
<t t-call="hr_timesheet.portal_timesheet_table"/>
|
|
</div>
|
|
<t t-if="timesheets_by_subtask">
|
|
<t t-call="hr_timesheet.portal_subtask_timesheet_tables"/>
|
|
</t>
|
|
</xpath>
|
|
</template>
|
|
|
|
<template id="portal_timesheet_table" name="Portal Timesheet Table">
|
|
<table class="table table-sm">
|
|
<thead>
|
|
<tr>
|
|
<th>Date</th>
|
|
<th>Employee</th>
|
|
<th>Description</th>
|
|
<th t-if="is_uom_day" class="text-right">Duration (Days)</th>
|
|
<th t-else="" class="text-right">Duration (Hours)</th>
|
|
</tr>
|
|
</thead>
|
|
<tr t-foreach="timesheets" t-as="timesheet">
|
|
<td><t t-esc="timesheet.date" t-options='{"widget": "date"}'/></td>
|
|
<td><t t-esc="timesheet.employee_id.name"/></td>
|
|
<td><t t-esc="timesheet.name"/></td>
|
|
<td class="text-right">
|
|
<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-right">Total Hours: <span t-esc="round(sum(timesheets.mapped('unit_amount')), 2)" t-options='{"widget": "float_time"}'/></th>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</template>
|
|
|
|
<template id="portal_subtask_timesheet_tables" name="Portal Subtask Timesheet Tables">
|
|
<t t-foreach="timesheets_by_subtask.values()" t-as="timesheets">
|
|
<t t-set="total_hours" t-value="round(sum(timesheets.mapped('unit_amount')), 2)"/>
|
|
<t t-if="total_hours > 0">
|
|
<div class="container">
|
|
<hr class="mt-4 mb-1"/>
|
|
<h5 class="mt-2 mb-2">Timesheets for sub-task: <t t-esc="timesheets[0].task_id.name" /></h5>
|
|
<table class="table table-sm">
|
|
<thead>
|
|
<tr>
|
|
<th>Date</th>
|
|
<th>Employee</th>
|
|
<th>Description</th>
|
|
<th class="text-right">Duration</th>
|
|
</tr>
|
|
</thead>
|
|
<tr t-foreach="timesheets" t-as="timesheet">
|
|
<td><t t-esc="timesheet.date" t-options='{"widget": "date"}'/></td>
|
|
<td><t t-esc="timesheet.employee_id.name"/></td>
|
|
<td><t t-esc="timesheet.name"/></td>
|
|
<td class="text-right"><span t-field="timesheet.unit_amount" t-options='{"widget": "float_time"}'/></td>
|
|
</tr>
|
|
<tfoot>
|
|
<tr>
|
|
<th class="text-right" colspan="3"></th>
|
|
<th class="text-right">Total Hours: <span t-esc="total_hours" t-options='{"widget": "float_time"}'/></th>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
</t>
|
|
</t>
|
|
</template>
|
|
|
|
</odoo>
|