File: project_task_portal_templates.xml

package info (click to toggle)
odoo 18.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 878,716 kB
  • sloc: javascript: 927,937; python: 685,670; xml: 388,524; sh: 1,033; sql: 415; makefile: 26
file content (77 lines) | stat: -rw-r--r-- 4,172 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?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="//div[@id='task-nav']" position="before">
            <div t-if="timesheets and allow_timesheets" class="d-grid flex-grow-1" id='nav-report'>
                <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>
            </div>
        </xpath>
        <xpath expr="//li[@id='nav-header']" position="after">
            <div t-if="timesheets and allow_timesheets" class="nav-item">
                <a class="nav-link p-0" href="#task_timesheets">
                    Timesheets
                </a>
            </div>
        </xpath>
        <xpath expr="//div[@id='card_body']" position="inside">
            <div class="container" t-if="timesheets and allow_timesheets">
                <h5 id="task_timesheets" class="mt-2 mb-2" data-anchor="true">Timesheets</h5>
                <t t-call="hr_timesheet.portal_timesheet_table"/>
            </div>
        </xpath>
        <xpath expr="//div[@name='portal_my_task_allocated_hours']" position="after">
            <div t-if="task.allocated_hours > 0 and allow_timesheets"><strong>Progress:</strong> <span t-esc="task.progress * 100" t-options='{"widget": "float", "precision": 0}'/>%</div>
        </xpath>
        <xpath expr="//div[@name='portal_my_task_allocated_hours']/t" position="replace">
            <t t-call="hr_timesheet.portal_my_task_allocated_hours_template"></t>
        </xpath>
    </template>

    <template id="portal_my_task_allocated_hours_template">
        <t t-if="allow_timesheets and task.allocated_hours > 0">
            <t t-if="is_uom_day">
                <span t-out="timesheets._convert_hours_to_days(task.allocated_hours)" t-options='{"widget": "timesheet_uom"}'/>
            </t>
            <t t-else="" t-call="project.portal_my_task_allocated_hours_template"></t>
        </t>
    </template>

    <template id="portal_tasks_list_inherit" inherit_id="project.portal_tasks_list" name="Portal: My Tasks with Timesheets">
        <xpath expr="//thead" position="before">
            <t t-set="allow_timesheets" t-value="any(task.allow_timesheets for group in grouped_tasks for task in group)"/>
        </xpath>
        <xpath expr="//t[@t-foreach='tasks']/tr" position="before">
            <t t-set="timesheet_ids" t-value="task.sudo().timesheet_ids"/>
            <t t-set="is_uom_day" t-value="timesheet_ids._is_timesheet_encode_uom_day()"/>
        </xpath>
        <xpath expr="//thead/tr/t[@t-set='number_of_header']" position="after">
            <t t-if="allow_timesheets">
                 <t t-set="number_of_header" t-value="number_of_header + 1"/>
            </t>
        </xpath>
        <xpath expr="//thead/tr/th[@name='project_portal_milestones']" position="after">
            <t t-if="not project or project.allow_timesheets">
                <th class="text-end">Time Spent</th>
            </t>
        </xpath>
        <xpath expr="//tbody/t/tr/td[@name='project_portal_milestones']" position="after">
            <td t-if="not project or project.allow_timesheets" class="text-end">
                <t t-if="task.allow_timesheets">
                    <t t-if="is_uom_day">
                        <t t-out="timesheet_ids._convert_hours_to_days(task.total_hours_spent)"/>
                        <span t-if="task.allocated_hours > 0"> / <t t-out="timesheet_ids._convert_hours_to_days(task.allocated_hours)"/></span>
                    </t>
                    <t t-else="">
                        <span t-field="task.total_hours_spent" t-options='{"widget": "float_time"}'/>
                        <t t-if="task.allocated_hours > 0">
                            /
                            <span t-field="task.allocated_hours" t-options='{"widget": "float_time"}'/>
                        </t>
                    </t>
                </t>
            </td>
        </xpath>
    </template>

</odoo>