| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<odoo> |
| 3 |
|
| 4 |
<template id="portal_my_task" inherit_id="project.portal_my_task" name="Portal: My Task with Timesheets"> |
| 5 |
<xpath expr="//div[hasclass('o_project_portal_sidebar')]" position="before"> |
| 6 |
<t t-set="show_portal_timesheets" t-value="timesheets and timesheets[0].env['account.analytic.line']._show_portal_timesheets()"/> |
| 7 |
</xpath> |
| 8 |
<xpath expr="//div[@id='task-nav']" position="before"> |
| 9 |
<div t-if="timesheets and allow_timesheets and show_portal_timesheets" class="d-grid flex-grow-1" id='nav-report'> |
| 10 |
<a class="btn btn-light o_print_btn o_project_timesheet_print d-block" t-att-href="task.get_portal_url(report_type='pdf')" href="#" title="View Details" role="button" target="_blank"><i class="fa fa-print"/> View Details</a> |
| 11 |
</div> |
| 12 |
</xpath> |
| 13 |
<xpath expr="//li[@id='nav-header']" position="after"> |
| 14 |
<div t-if="timesheets and allow_timesheets and show_portal_timesheets" class="nav-item"> |
| 15 |
<a class="nav-link p-0" href="#task_timesheets"> |
| 16 |
Timesheets |
| 17 |
</a> |
| 18 |
</div> |
| 19 |
</xpath> |
| 20 |
<xpath expr="//div[@id='card_body']" position="inside"> |
| 21 |
<div class="container" t-if="timesheets and allow_timesheets and show_portal_timesheets"> |
| 22 |
<h5 id="task_timesheets" class="mt-2 mb-2" data-anchor="true">Timesheets</h5> |
| 23 |
<t t-call="hr_timesheet.portal_timesheet_table"/> |
| 24 |
</div> |
| 25 |
</xpath> |
| 26 |
<xpath expr="//div[@name='portal_my_task_allocated_hours']" position="after"> |
| 27 |
<div t-if="task.allocated_hours > 0 and allow_timesheets and show_portal_timesheets"><strong>Progress:</strong> <span t-esc="task.progress * 100" t-options='{"widget": "float", "precision": 0}'/>%</div> |
| 28 |
</xpath> |
| 29 |
<xpath expr="//div[@name='portal_my_task_allocated_hours']/t" position="replace"> |
| 30 |
<t t-call="hr_timesheet.portal_my_task_allocated_hours_template"></t> |
| 31 |
</xpath> |
| 32 |
</template> |
| 33 |
|
| 34 |
<template id="portal_my_task_allocated_hours_template"> |
| 35 |
<t t-if="allow_timesheets and task.allocated_hours > 0"> |
| 36 |
<t t-if="is_uom_day"> |
| 37 |
<span t-out="timesheets._convert_hours_to_days(task.allocated_hours)" t-options='{"widget": "timesheet_uom"}'/> |
| 38 |
</t> |
| 39 |
<t t-else="" t-call="project.portal_my_task_allocated_hours_template"></t> |
| 40 |
</t> |
| 41 |
</template> |
| 42 |
|
| 43 |
<template id="portal_tasks_list_inherit" inherit_id="project.portal_tasks_list" name="Portal: My Tasks with Timesheets"> |
| 44 |
<xpath expr="//thead" position="before"> |
| 45 |
<t t-set="allow_timesheets" t-value="any(task.allow_timesheets for group in grouped_tasks for task in group)"/> |
| 46 |
<t t-set="show_portal_timesheets" t-value="grouped_tasks[0][0].env['account.analytic.line']._show_portal_timesheets()"/> |
| 47 |
</xpath> |
| 48 |
<xpath expr="//t[@t-foreach='tasks']/tr" position="before"> |
| 49 |
<t t-set="timesheet_ids" t-value="task.sudo().timesheet_ids"/> |
| 50 |
<t t-set="is_uom_day" t-value="timesheet_ids._is_timesheet_encode_uom_day()"/> |
| 51 |
</xpath> |
| 52 |
<xpath expr="//thead/tr/th[@name='project_portal_milestones']" position="after"> |
| 53 |
<t t-if="(not project or project.allow_timesheets) and show_portal_timesheets"> |
| 54 |
<th class="text-end">Time Spent</th> |
| 55 |
</t> |
| 56 |
</xpath> |
| 57 |
<xpath expr="//th[@name='state_col']" position="before"> |
| 58 |
<th t-if="not project or project.allow_timesheets" class="text-end text-muted fw-normal"> |
| 59 |
<t t-set="total_hours_dict" t-value="tasks._get_portal_total_hours_dict()"/> |
| 60 |
<t t-if="total_hours_dict"> |
| 61 |
<t t-set="total_allocated_hours" t-value="tasks.project_id.allocated_hours if groupby == 'project_id' else total_hours_dict['allocated_hours']"/> |
| 62 |
<t t-set="total_effective_hours" t-value="total_hours_dict['effective_hours']"/> |
| 63 |
<span> |
| 64 |
Total: |
| 65 |
<t t-if="is_uom_day"> |
| 66 |
<t t-out="tasks._convert_hours_to_days(total_effective_hours)" t-options='{"widget": "timesheet_uom"}'/> |
| 67 |
<t t-if="total_allocated_hours"> / |
| 68 |
<t t-out="tasks._convert_hours_to_days(total_allocated_hours)" t-options='{"widget": "timesheet_uom"}'/> |
| 69 |
</t> |
| 70 |
</t> |
| 71 |
<t t-else=""> |
| 72 |
<t t-out="total_effective_hours" t-options='{"widget": "float_time"}'/> |
| 73 |
<t t-if="total_allocated_hours"> / |
| 74 |
<t t-out="total_allocated_hours" t-options='{"widget": "float_time"}'/> |
| 75 |
</t> |
| 76 |
</t> |
| 77 |
</span> |
| 78 |
</t> |
| 79 |
</th> |
| 80 |
</xpath> |
| 81 |
<xpath expr="//tbody/t/tr/td[@name='project_portal_milestones']" position="after"> |
| 82 |
<td t-if="(not project or project.allow_timesheets) and show_portal_timesheets" class="text-end"> |
| 83 |
<t t-if="task.allow_timesheets"> |
| 84 |
<t t-if="is_uom_day"> |
| 85 |
<t t-out="timesheet_ids._convert_hours_to_days(task.total_hours_spent)"/> |
| 86 |
<span t-if="task.allocated_hours > 0"> / <t t-out="timesheet_ids._convert_hours_to_days(task.allocated_hours)"/></span> |
| 87 |
</t> |
| 88 |
<t t-else=""> |
| 89 |
<span t-field="task.total_hours_spent" t-options='{"widget": "float_time"}'/> |
| 90 |
<t t-if="task.allocated_hours > 0"> |
| 91 |
/ |
| 92 |
<span t-field="task.allocated_hours" t-options='{"widget": "float_time"}'/> |
| 93 |
</t> |
| 94 |
</t> |
| 95 |
</t> |
| 96 |
</td> |
| 97 |
</xpath> |
| 98 |
</template> |
| 99 |
|
| 100 |
</odoo> |