Debian Codegraph @

addons/hr_timesheet/report/report_timesheet_templates.xml

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <odoo>
3 <template id="hr_timesheet.timesheet_table">
4 <t t-set='is_uom_day' t-value='lines._is_timesheet_encode_uom_day()'/>
5 <div class="row mt8">
6 <div class="col-12">
7 <table class="table table-sm">
8 <thead style="display: table-row-group">
9 <tr>
10 <t t-set="timesheet_record_label" t-value="False"/>
11 <t t-if="show_task">
12 <t t-set="timesheet_record_label">Task</t>
13 </t>
14 <t t-elif="show_project">
15 <t t-set="timesheet_record_label">Project</t>
16 </t>
17 <th class="text-start align-middle"><span>Date</span></th>
18 <th class="text-start align-middle"><span>Employee</span></th>
19 <th class="text-start align-middle" t-if="timesheet_record_label"><span t-out="timesheet_record_label"/></th>
20 <th class="text-start align-middle"><span>Description</span></th>
21 <th class="text-end">
22 <span>Time Spent</span>
23 </th>
24 </tr>
25 </thead>
26 <tbody>
27 <tr t-foreach="lines" t-as="line" t-att-style="'background-color: #F1F1F1;' if line_index % 2 == 0 else ''">
28 <td class="align-middle">
29 <span t-field="line.date">2021-09-01</span>
30 </td>
31 <td class="align-middle">
32 <span t-if="line.user_id.partner_id.name" t-field="line.user_id.partner_id.name">Audrey Peterson</span>
33 <span t-else="" t-field="line.employee_id">Audrey Peterson</span>
34 </td>
35 <t t-set="timesheet_record_info" t-value="False"/>
36 <t t-if="show_project">
37 <t t-set="timesheet_record_info" t-value="line.project_id.sudo().name"/>
38 <t t-if="show_task and line.task_id" t-set="timesheet_record_info" t-value="'%s / %s' % (timesheet_record_info, line.task_id.sudo().name)"/>
39 </t>
40 <t t-elif="show_task" t-set="timesheet_record_info" t-value="line.task_id.sudo().name"/>
41 <td t-if="show_task or show_project" class="align-middle">
42 <span t-if="timesheet_record_info" t-out="timesheet_record_info">Research and Development/New Portal System</span>
43 </td>
44 <td class="align-middle">
45 <span t-field="line.name" t-options="{'widget': 'text'}">Call client and discuss project</span>
46 </td>
47 <td class="text-end align-middle">
48 <span t-if="not is_uom_day" t-field="line.unit_amount" t-options="{'widget': 'duration', 'digital': True, 'unit': 'hour', 'round': 'minute'}">2 hours</span>
49 <span t-else="" t-esc="line._get_timesheet_time_day()" t-options="{'widget': 'timesheet_uom'}">1 day</span>
50 </td>
51 </tr>
52 <tr>
53 <td class="text-end" colspan="100">
54 <strong t-if="not is_uom_day">
55 <span style="margin-right: 15px;">Total (Hours)</span>
56 <t t-esc="sum(lines.mapped('unit_amount'))" t-options="{'widget': 'duration', 'digital': True, 'unit': 'hour', 'round': 'minute'}">2 hours</t>
57 </strong>
58 <strong t-else="">
59 <span style="margin-right: 15px;">Total (Days)</span>
60 <t t-esc="lines._convert_hours_to_days(sum(lines.mapped('unit_amount')))" t-options="{'widget': 'timesheet_uom'}">1 day</t>
61 </strong>
62 </td>
63 </tr>
64 </tbody>
65 </table>
66 </div>
67 </div>
68 </template>
69
70 <template id="hr_timesheet.timesheet_project_task_page">
71 <t t-set="show_record" t-value="len(docs.ids) == 1"/>
72 <t t-set="title" t-value="docs._description"/>
73 <t t-set="company" t-value="docs.company_id if len(docs) == 1 else docs.env.company"/>
74 <t t-set="show_task" t-value="True"/>
75 <t t-if="not from_project">
76 <t t-set="show_task" t-value="False"/>
77 <t t-set="timesheet_report_data" t-value="docs._get_timesheet_report_data()"/>
78 <t t-set="timesheets_per_task" t-value="timesheet_report_data['timesheets_per_task']"/>
79 <t t-set="subtask_ids_per_task_id" t-value="timesheet_report_data['subtask_ids_per_task_id']"/>
80 </t>
81 <t t-call="web.html_container">
82 <t t-call="web.internal_layout">
83 <div class="page">
84 <t t-foreach="docs" t-as="doc">
85 <div class="oe_structure"/>
86 <div class="mt8">
87 <t t-set="lines" t-value="doc.timesheet_ids if from_project else timesheets_per_task.get(doc, doc.env['account.analytic.line'])"/>
88 <h1 t-if="lines">
89 <t t-out="title"/>: <t t-out="doc.name"/>
90 </h1>
91 <t t-if="lines" t-call="hr_timesheet.timesheet_table"/>
92 <t t-if="not from_project">
93 <t t-set="task_id" t-value="doc.id"/>
94 <t t-call="hr_timesheet.timesheet_report_subtask"/>
95 </t>
96 </div>
97 </t>
98 </div>
99 </t>
100 </t>
101 </template>
102
103 <template id="timesheet_report_subtask">
104 <t t-set="subtasks" t-value="doc.browse(subtask_ids_per_task_id.get(task_id, []))"/>
105 <t t-foreach="subtasks.sorted('sequence')" t-as="subtask">
106 <t t-if="subtask in timesheets_per_task">
107 <h2 class="my-4">
108 Sub-Task of '<t t-out="doc.name"/>': <t t-out="subtask.name"/>
109 </h2>
110 <t t-set="lines" t-value="timesheets_per_task[subtask]"/>
111 <t t-call="hr_timesheet.timesheet_table"/>
112 </t>
113 <t t-set="task_id" t-value="subtask.id"/>
114 <t t-call="hr_timesheet.timesheet_report_subtask"/>
115 </t>
116 </template>
117
118 <template id="report_timesheet">
119 <t t-call="web.html_container">
120 <t t-call="web.internal_layout">
121 <t t-set="company" t-value="docs.project_id.sudo().company_id if len(docs.project_id) == 1 else docs.env.company"/>
122 <t t-set="show_task" t-value="bool(docs.task_id)"/>
123 <t t-set="show_project" t-value="len(docs.project_id) > 1"/>
124 <div class="page">
125 <div class="oe_structure"/>
126 <div class="row mt8">
127 <div class="col-lg-12">
128 <h2>
129 <span>Timesheets
130 <t t-if="len(docs.project_id) == 1">
131 for the <t t-out="docs.project_id.sudo().name">Research and Development</t> Project
132 </t>
133 </span>
134 </h2>
135 </div>
136 </div>
137 <t t-set='lines' t-value='docs'/>
138 <t t-call="hr_timesheet.timesheet_table"/>
139 <div class="oe_structure"/>
140 </div>
141 </t>
142 </t>
143 </template>
144
145 <!-- Project Task Timesheet Report for given timesheets -->
146 <template id="report_timesheet_task">
147 <t t-call="web.html_container">
148 <t t-call="web.internal_layout">
149 <t t-set="company" t-value="docs.project_id.company_id if len(docs.project_id) == 1 else docs.env.company"/>
150 <t t-set="show_task" t-value="len(docs.task_id) > 1"/>
151 <t t-set="show_project" t-value="False"/>
152 <div class="page">
153 <div class="oe_structure"/>
154 <div class="row mt8">
155 <div class="col-12">
156 <h2>
157 <span>Timesheets
158 <t t-if="len(docs.task_id) == 1">
159 for <t t-out="docs.task_id.name"/>
160 </t>
161 </span>
162 </h2>
163 </div>
164 </div>
165 <t t-set='lines' t-value='docs'/>
166 <t t-call="hr_timesheet.timesheet_table"/>
167 <div class="oe_structure"/>
168 </div>
169 </t>
170 </t>
171 </template>
172
173 <record id="timesheet_report" model="ir.actions.report">
174 <field name="name">Timesheets</field>
175 <field name="model">account.analytic.line</field>
176 <field name="report_type">qweb-pdf</field>
177 <field name="report_name">hr_timesheet.report_timesheet</field>
178 <field name="report_file">report_timesheet</field>
179 <field name="binding_model_id" ref="model_account_analytic_line"/>
180 <field name="binding_type">report</field>
181 </record>
182
183 <!-- Project Task Timesheet Report -->
184 <template id="report_project_task_timesheet">
185 <t t-call="hr_timesheet.timesheet_project_task_page"/>
186 </template>
187
188 <record id="timesheet_report_task" model="ir.actions.report">
189 <field name="name">Timesheets</field>
190 <field name="model">project.task</field>
191 <field name="group_ids" eval="[(4,ref('hr_timesheet.group_hr_timesheet_user'))]"/>
192 <field name="report_type">qweb-pdf</field>
193 <field name="report_name">hr_timesheet.report_project_task_timesheet</field>
194 <field name="report_file">report_timesheet_task</field>
195 <field name="binding_model_id" ref="model_project_task"/>
196 <field name="binding_type">report</field>
197 </record>
198
199 <!-- Project Timesheet Report -->
200 <template id="report_timesheet_project">
201 <t t-set="from_project" t-value="True"/>
202 <t t-call="hr_timesheet.timesheet_project_task_page"/>
203 </template>
204
205 <record id="timesheet_report_project" model="ir.actions.report">
206 <field name="name">Timesheets</field>
207 <field name="model">project.project</field>
208 <field name="group_ids" eval="[(4,ref('hr_timesheet.group_hr_timesheet_user'))]"/>
209 <field name="report_type">qweb-pdf</field>
210 <field name="report_name">hr_timesheet.report_timesheet_project</field>
211 <field name="report_file">report_timesheet_project</field>
212 <field name="binding_model_id" ref="model_project_project"/>
213 </record>
214
215 <record id="timesheet_report_task_timesheets" model="ir.actions.report">
216 <field name="name">Timesheets</field>
217 <field name="model">account.analytic.line</field>
218 <field name="report_type">qweb-pdf</field>
219 <field name="report_name">hr_timesheet.report_timesheet_task</field>
220 <field name="report_file">report_timesheet</field>
221 <field name="binding_type">report</field>
222 </record>
223 </odoo>