| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<odoo> |
| 3 |
<template id="portal_layout" name="Portal layout: timesheet menu entry" inherit_id="portal.portal_breadcrumbs" priority="35"> |
| 4 |
<xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside"> |
| 5 |
<li t-if="page_name == 'timesheet' or timesheet" t-attf-class="breadcrumb-item #{'active' if not timesheet else ''}"> |
| 6 |
<t>Timesheets</t> |
| 7 |
</li> |
| 8 |
</xpath> |
| 9 |
</template> |
| 10 |
|
| 11 |
<template id="portal_my_home_timesheet" name="Timesheets" customize_show="True" inherit_id="portal.portal_my_home" priority="45"> |
| 12 |
<xpath expr="//div[hasclass('o_portal_docs')]" position="before"> |
| 13 |
<t t-set="portal_service_category_enable" t-value="True"/> |
| 14 |
</xpath> |
| 15 |
<div id="portal_service_category" position="inside"> |
| 16 |
<t t-call="portal.portal_docs_entry"> |
| 17 |
<t t-set="icon" t-value="'/hr_timesheet/static/img/timesheet.svg'"/> |
| 18 |
<t t-set="title">Timesheets</t> |
| 19 |
<t t-set="url" t-value="'/my/timesheets'"/> |
| 20 |
<t t-set="text">Review all timesheets related to your projects</t> |
| 21 |
<t t-set="placeholder_count" t-value="'timesheet_count'"/> |
| 22 |
</t> |
| 23 |
</div> |
| 24 |
</template> |
| 25 |
|
| 26 |
<template id="portal_my_timesheets" name="My Timesheets"> |
| 27 |
<t t-call="portal.portal_layout"> |
| 28 |
<t t-set="breadcrumbs_searchbar" t-value="True"/> |
| 29 |
|
| 30 |
<t t-call="portal.portal_searchbar"> |
| 31 |
<t t-set="title">Timesheets</t> |
| 32 |
</t> |
| 33 |
<t t-if="not grouped_timesheets"> |
| 34 |
<div class="alert alert-warning" role="alert"> |
| 35 |
There are no timesheets. |
| 36 |
</div> |
| 37 |
</t> |
| 38 |
<t t-if="grouped_timesheets"> |
| 39 |
<t t-call="portal.portal_table"> |
| 40 |
<thead> |
| 41 |
<tr> |
| 42 |
<th t-if="not groupby == 'date'">Date</th> |
| 43 |
<th t-if="not groupby == 'employee_id'">Employee</th> |
| 44 |
<th t-if="not groupby == 'project_id'">Project</th> |
| 45 |
<th t-if="not groupby == 'task_id'">Task</th> |
| 46 |
<th>Description</th> |
| 47 |
<th class="text-end" t-att-colspan="2 if groupby != 'none' else 0" name="t_label">Time Spent</th> |
| 48 |
</tr> |
| 49 |
</thead> |
| 50 |
<t t-foreach="grouped_timesheets" t-as="timesheets_with_hours"> |
| 51 |
<t t-set="timesheets" t-value="timesheets_with_hours[0]"/> |
| 52 |
<t t-set="hours_spent" t-value="timesheets_with_hours[1]"/> |
| 53 |
<tbody style="font-size: 0.8rem"> |
| 54 |
<tr t-if="not groupby =='none'" class="table-light"> |
| 55 |
<t t-if="groupby == 'project_id'"> |
| 56 |
<th colspan="5"> |
| 57 |
<span t-field="timesheets[0].project_id.name"/> |
| 58 |
</th> |
| 59 |
</t> |
| 60 |
<t t-elif="groupby == 'task_id'"> |
| 61 |
<th colspan="5"> |
| 62 |
<span t-if="timesheets[0].task_id" t-field="timesheets[0].task_id.name"/> |
| 63 |
<span t-else="">No Task</span> |
| 64 |
</th> |
| 65 |
</t> |
| 66 |
<t t-elif="groupby == 'date'"> |
| 67 |
<th colspan="5"> |
| 68 |
<span t-field="timesheets[0].date"/> |
| 69 |
</th> |
| 70 |
</t> |
| 71 |
<t t-elif="groupby == 'employee_id'"> |
| 72 |
<th colspan="5"> |
| 73 |
<span t-field="timesheets[0].employee_id.name"/> |
| 74 |
</th> |
| 75 |
</t> |
| 76 |
<t t-elif="groupby == 'parent_task_id'"> |
| 77 |
<th colspan="6"> |
| 78 |
<span t-if="timesheets[0].parent_task_id" t-field="timesheets[0].parent_task_id.name"/> |
| 79 |
<span t-else="">No Parent Task</span> |
| 80 |
</th> |
| 81 |
</t> |
| 82 |
<th colspan="1" class="text-end text-muted"> |
| 83 |
<t t-if="is_uom_day"> |
| 84 |
Total: <span t-esc="timesheets._convert_hours_to_days(hours_spent)" t-options='{"widget": "timesheet_uom"}'/> |
| 85 |
</t> |
| 86 |
<t t-else=""> |
| 87 |
Total: <span t-esc="hours_spent" t-options='{"widget": "float_time"}'/> |
| 88 |
</t> |
| 89 |
</th> |
| 90 |
</tr> |
| 91 |
</tbody> |
| 92 |
<tbody style="font-size: 0.8rem"> |
| 93 |
<t t-foreach="timesheets" t-as="timesheet"> |
| 94 |
<tr> |
| 95 |
<td t-if="not groupby == 'date'"><span t-field="timesheet.date" t-options='{"widget": "date"}'/></td> |
| 96 |
<td t-if="not groupby == 'employee_id'"><span t-field="timesheet.employee_id" t-att-title="timesheet.employee_id.display_name" /></td> |
| 97 |
<td t-if="not groupby == 'project_id'"><span t-field="timesheet.project_id" t-att-title="timesheet.project_id.display_name"/></td> |
| 98 |
<td t-if="not groupby == 'task_id'"><span t-field="timesheet.task_id" t-att-title="timesheet.task_id.display_name"/></td> |
| 99 |
<td><span t-esc="timesheet.name" t-att-title="timesheet.name"/></td> |
| 100 |
<td class="text-end" t-att-colspan="2 if groupby != 'none' else 0"> |
| 101 |
<span t-if="is_uom_day" t-esc="timesheet._get_timesheet_time_day()" t-options='{"widget": "timesheet_uom"}'/> |
| 102 |
<span t-else="" t-field="timesheet.unit_amount" t-options='{"widget": "float_time"}'/> |
| 103 |
</td> |
| 104 |
</tr> |
| 105 |
</t> |
| 106 |
</tbody> |
| 107 |
</t> |
| 108 |
</t> |
| 109 |
</t> |
| 110 |
</t> |
| 111 |
</template> |
| 112 |
|
| 113 |
<template id="portal_timesheet_table" name="Portal Timesheet Table"> |
| 114 |
<table class="o_portal_my_doc_table table table-sm table-striped"> |
| 115 |
<thead> |
| 116 |
<tr> |
| 117 |
<th>Date</th> |
| 118 |
<th>Employee</th> |
| 119 |
<th>Description</th> |
| 120 |
<th class="text-end" name="t_label">Time Spent</th> |
| 121 |
</tr> |
| 122 |
</thead> |
| 123 |
<tr t-foreach="timesheets" t-as="timesheet" valign="middle"> |
| 124 |
<td><t t-esc="timesheet.date" t-options='{"widget": "date"}'/></td> |
| 125 |
<td t-attf-title="#{timesheet.employee_id.name}"><t t-esc="timesheet.employee_id.name"/></td> |
| 126 |
<td><t t-esc="timesheet.name"/></td> |
| 127 |
<td class="text-end"> |
| 128 |
<span t-if="is_uom_day" t-esc="timesheet._get_timesheet_time_day()" t-options='{"widget": "timesheet_uom"}'/> |
| 129 |
<span t-else="" t-field="timesheet.unit_amount" t-options='{"widget": "float_time"}'/> |
| 130 |
</td> |
| 131 |
</tr> |
| 132 |
</table> |
| 133 |
<div class="container_subtotal"> |
| 134 |
<div class="row justify-content-end"> |
| 135 |
<div t-attf-class="{{'col-auto' if report_type != 'html' else 'col-sm-2'}}"> |
| 136 |
<table class="table table-sm"> |
| 137 |
<tr> |
| 138 |
<td><strong>Total Time Spent: </strong></td> |
| 139 |
<td class="text-end"> |
| 140 |
<span t-if="is_uom_day" t-esc="timesheets._convert_hours_to_days(task.effective_hours)" t-options="{'widget': 'timesheet_uom'}"/> |
| 141 |
<span t-else="" t-esc="task.effective_hours" t-options='{"widget": "float_time"}'/> |
| 142 |
</td> |
| 143 |
</tr> |
| 144 |
<tr> |
| 145 |
<div t-if="task.subtask_effective_hours"> |
| 146 |
<td><strong>Time recorded on sub-tasks: </strong></td> |
| 147 |
<td class="text-end"> |
| 148 |
<span t-if="is_uom_day" t-esc="timesheets._convert_hours_to_days(task.subtask_effective_hours)" t-options='{"widget": "timesheet_uom"}'/> |
| 149 |
<span t-else="" t-esc="task.subtask_effective_hours" t-options='{"widget": "float_time"}'/> |
| 150 |
</td> |
| 151 |
</div> |
| 152 |
</tr> |
| 153 |
<tr> |
| 154 |
<div t-if="task.total_hours_spent and task.subtask_effective_hours" name="total_time"> |
| 155 |
<t t-if="is_uom_day"> |
| 156 |
<td><strong>Total Days: </strong></td> |
| 157 |
<td class="text-end"> |
| 158 |
<span t-esc="timesheets._convert_hours_to_days(task.total_hours_spent)" t-options='{"widget": "timesheet_uom"}'/> |
| 159 |
</td> |
| 160 |
</t> |
| 161 |
<t t-else=""> |
| 162 |
<td><strong>Total Hours: </strong></td> |
| 163 |
<td class="text-end"> |
| 164 |
<span t-esc="task.total_hours_spent" t-options='{"widget": "float_time"}'/> |
| 165 |
</td> |
| 166 |
</t> |
| 167 |
</div> |
| 168 |
</tr> |
| 169 |
<tr t-attf-class="{{task.remaining_hours < 0 and 'text-danger' or ''}}"> |
| 170 |
<div t-if="task.allocated_hours > 0" name="allocated_time"> |
| 171 |
<td><strong>Time Remaining: </strong></td> |
| 172 |
<td class="text-end"> |
| 173 |
<span t-if="is_uom_day" t-esc="timesheets._convert_hours_to_days(task.remaining_hours)" t-options='{"widget": "timesheet_uom"}'/> |
| 174 |
<span t-else="" t-esc="task.remaining_hours" t-options='{"widget": "float_time"}'/> |
| 175 |
</td> |
| 176 |
</div> |
| 177 |
</tr> |
| 178 |
</table> |
| 179 |
</div> |
| 180 |
</div> |
| 181 |
</div> |
| 182 |
</template> |
| 183 |
</odoo> |