Debian Codegraph @

addons/project/views/project_portal_project_task_templates.xml

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <odoo>
3 <template id="portal_my_tasks_priority_widget_template" name="Priority Widget Template">
4 <t t-set="priority_label" t-value="priority_labels[task.priority]"/>
5 <span t-attf-class="o_priority_star d-inline-block fa fa-star#{' text-warning' if task.priority != '0' else '-o opacity-75'} #{classes if classes else ''}" t-att-title="priority_label"/>
6 <span t-attf-class="o_priority_star d-inline-block fa fa-star#{' text-warning' if task.priority in ['2', '3'] else '-o opacity-75'} #{classes if classes else ''}" t-att-title="priority_label"/>
7 <span t-attf-class="o_priority_star d-inline-block fa fa-star#{' text-warning' if task.priority == '3' else '-o opacity-75'} #{classes if classes else ''}" t-att-title="priority_label"/>
8 </template>
9
10 <template id="portal_my_tasks_state_widget_template" name="Status Widget Template">
11 <span
12 t-att-title="dict(task.fields_get(allfields=['state'])['state']['selection'])[task.state]"
13 t-attf-class="#{'fa' if task.state in ['1_done','1_canceled','04_waiting_normal'] else 'o_status rounded-circle' } #{'fa-check-circle text-success' if task.state == '1_done' else 'fa-times-circle text-danger' if task.state == '1_canceled' else 'bg-warning' if task.state == '02_changes_requested' else 'bg-success' if task.state == '03_approved' else 'fa-hourglass-o' if task.state == '04_waiting_normal' else ''}"
14 />
15 </template>
16 <template id="portal_my_tasks_badge_widget_template" name="badge Widget Template">
17 <span t-attf-class="badge rounded-pill o_tag o_badge_color_#{task.stage_id_color}"
18 t-attf-title="#{task.stage_id.name}" t-out="task.stage_id.name"
19 />
20 </template>
21
22 <template id="portal_tasks_list" name="Tasks List">
23 <t t-if="grouped_tasks">
24 <t t-call="portal.portal_table">
25 <thead>
26 <tr>
27 <!-- Allows overrides in modules -->
28 <t t-set="group_by_in_header_list" t-value="['priority', 'milestone_id']"></t>
29 <t t-if="multiple_projects" t-set="group_by_in_header_list" t-value="group_by_in_header_list + ['project_id']"/>
30 <!-- Computes the right colspan once and use it everywhere -->
31 <t t-set="grouped_tasks_colspan" t-value="5 if groupby in group_by_in_header_list else 6"></t>
32 <t t-set="grouped_tasks_colspan" t-if="not allow_milestone" t-value="grouped_tasks_colspan - 1"></t>
33 <t t-set="grouped_tasks_colspan" t-if="not multiple_projects" t-value="grouped_tasks_colspan - 1"/>
34 <th t-attf-colspan="{{2 if groupby != 'priority' else 1}}"/>
35 <th>Name</th>
36 <th>Assignees</th>
37 <th t-if="groupby != 'project_id' and multiple_projects">Project</th>
38 <th t-if="groupby != 'milestone_id' and allow_milestone" name="project_portal_milestones">Milestone</th>
39 <th t-if="groupby != 'state'"/>
40 <th t-if="groupby != 'stage_id'" class="text-end">Stage</th>
41 </tr>
42 </thead>
43 <t t-foreach="grouped_tasks" t-as="tasks">
44 <tbody t-if="tasks">
45 <tr name="grouped_tasks_groupby_columns" t-if="groupby != 'none'" class="table-light">
46 <th name="groupby_name_col" t-att-colspan="grouped_tasks_colspan">
47 <t t-if="groupby == 'project_id' and multiple_projects">
48 <!-- This div is necessary for documents_project_sale -->
49 <div name="project_name" class="d-flex w-100 align-items-center">
50 <span t-if="tasks[0].sudo().project_id" t-field="tasks[0].sudo().project_id.name"/>
51 <span t-else="">No Project</span>
52 </div>
53 </t>
54 <t t-elif="groupby == 'milestone_id'">
55 <span t-if="tasks[0].sudo().milestone_id and tasks[0].sudo().allow_milestones"
56 class="text-truncate"
57 t-field="tasks[0].sudo().milestone_id.name"/>
58 <span t-else="">No Milestone</span>
59 </t>
60 <t t-if="groupby == 'stage_id'">
61 <!-- This div is necessary for documents_project_sale -->
62 <div name="stage_name" class="d-flex w-100 align-items-center">
63 <span class="text-truncate" t-field="tasks[0].sudo().stage_id.name"/>
64 </div>
65 </t>
66 <t t-if="groupby == 'priority'">
67 <span class="text-truncate" t-field="tasks[0].sudo().priority"/>
68 </t>
69 <t t-if="groupby == 'state'">
70 <span class="text-truncate" t-field="tasks[0].sudo().state"/>
71 </t>
72 <t t-if="groupby == 'partner_id'">
73 <span t-if="tasks[0].sudo().partner_id"
74 class="text-truncate"
75 t-field="tasks[0].sudo().partner_id.name"/>
76 <span t-else="">No Customer</span>
77 </t>
78 </th>
79 <th name="state_col" t-if="groupby != 'state'"/>
80 <th name="stage_id_col" t-if="groupby != 'stage_id'"/>
81 </tr>
82 </tbody>
83 <tbody t-if="tasks">
84 <t t-foreach="tasks" t-as="task">
85 <tr>
86 <td class="text-start">
87 #<span t-esc="task.id"/>
88 </td>
89 <td t-if="groupby != 'priority'" class="text-end">
90 <t t-call="project.portal_my_tasks_priority_widget_template"/>
91 </td>
92 <td>
93 <a t-attf-href="/my/#{task_url}/#{task.id}?{{ keep_query() }}"><span t-att-title="task.name" t-field="task.name"/></a>
94 </td>
95 <td>
96 <t t-set="assignees" t-value="task.sudo().user_ids"/>
97 <div t-if="assignees" class="flex-nowrap ps-3">
98 <img class="o_avatar rounded" t-attf-src="#{image_data_uri(assignees[:1].avatar_128)}" alt="User"/>
99 <span class="align-middle" t-att-title="'\n'.join(assignees.mapped('name'))">
100 <span t-field="assignees[:1].name"/><span t-if="len(assignees) &gt; 1" class="badge ms-1 rounded-pill bg-light"> +<span t-out="len(assignees) - 1"/></span>
101 </span>
102 </div>
103 </td>
104 <td t-if="groupby != 'project_id' and multiple_projects">
105 <span title="Current project of the task" t-out="task.project_id.name" />
106 </td>
107 <td t-if="groupby != 'milestone_id' and allow_milestone" name="project_portal_milestones">
108 <t t-if="task.milestone_id and task.allow_milestones">
109 <span t-esc="task.milestone_id.name" />
110 </t>
111 </td>
112 <td t-if="groupby != 'state'" align="right" class="align-middle">
113 <t t-call="project.portal_my_tasks_state_widget_template">
114 <t t-set="path" t-value="'tasks'"/>
115 </t>
116 </td>
117 <td t-if="groupby != 'stage_id'" class="text-end lh-1">
118 <t t-call="project.portal_my_tasks_badge_widget_template"/>
119 </td>
120 </tr>
121 </t>
122 </tbody>
123 </t>
124 </t>
125 </t>
126 </template>
127
128 <template id="portal_my_tasks" name="My Tasks">
129 <t t-call="portal.portal_layout">
130 <t t-set="breadcrumbs_searchbar" t-value="True"/>
131
132 <t t-call="portal.portal_searchbar">
133 <t t-set="title">Tasks</t>
134 </t>
135 <t t-if="not grouped_tasks">
136 <div class="alert alert-warning" role="alert">
137 There are no tasks.
138 </div>
139 </t>
140 <t t-call="project.portal_tasks_list"/>
141 </t>
142 </template>
143
144 <template id="task_link_preview_front_end" inherit_id="portal.frontend_layout" primary="True">
145 <xpath expr="//t[@t-if='not_uses_default_logo'][1]" position="before">
146 <t t-if="preview_object.displayed_image_id">
147 <meta property="og:image" t-attf-content="/web/image/{{ preview_object.displayed_image_id.id }}/300x200?access_token={{ preview_object.displayed_image_id.generate_access_token()[0] }}"/>
148 </t>
149 </xpath>
150 <xpath expr="//t[@t-if='not_uses_default_logo'][2]" position="before">
151 <t t-if="preview_object.displayed_image_id">
152 <meta property="twitter:image" t-attf-content="/web/image/{{ preview_object.displayed_image_id.id }}/300x200?access_token={{ preview_object.displayed_image_id.generate_access_token()[0] }}"/>
153 </t>
154 </xpath>
155 </template>
156
157 <template id="task_link_preview_portal_layout" inherit_id="portal.portal_layout" primary="True">
158 <xpath expr="//t[@t-call='portal.frontend_layout']" position="attributes">
159 <attribute name="t-call">project.task_link_preview_front_end</attribute>
160 </xpath>
161 </template>
162
163 <template id="portal_my_task" name="My Task" inherit_id="portal.portal_sidebar" primary="True">
164 <xpath expr="//t[@t-call='portal.portal_layout']" position="attributes">
165 <attribute name="t-call">project.task_link_preview_portal_layout</attribute>
166 </xpath>
167 <xpath expr="//t[@t-call='project.task_link_preview_portal_layout']" position="before">
168 <t t-set="o_portal_fullwidth_alert" groups="project.group_project_user">
169 <t t-call="portal.portal_back_in_edit_mode">
170 <t t-set="backend_url" t-value="'/odoo/action-project.action_view_my_task/%s' % (task.id)"/>
171 </t>
172 </t>
173 </xpath>
174 <xpath expr="//div[hasclass('o_portal_sidebar')]" position="inside">
175 <t t-set="title" t-value="task.name"/>
176
177 <div class="row o_project_portal_sidebar">
178 <t t-call="portal.portal_record_sidebar">
179 <t t-set="classes" t-value="'col-lg-4 col-xxl-3 d-print-none'"/>
180
181 <t t-set="entries">
182 <div class="d-flex flex-wrap flex-column gap-4">
183 <div id="task-nav" class="d-flex align-items-center flex-grow-1 p-0" t-ignore="true" role="complementary">
184 <ul class="nav flex-column">
185 <li class="nav-item" id="nav-header">
186 <a class="nav-link p-0" href="#card_header">
187 Task
188 </a>
189 </li>
190 <li class="nav-item" id="nav-chat">
191 <a class="nav-link p-0" href="#task_chat">
192 History
193 </a>
194 </li>
195 </ul>
196 </div>
197 <div id="task-links" t-if="task_link_section" class="d-flex align-items-center flex-grow-1 ps-0" t-ignore="true" role="complementary">
198 <ul class="nav flex-column">
199 <t t-foreach="task_link_section" t-as="task_link">
200 <li class="nav-item">
201 <a class="nav-link p-0" t-att-href="task_link['access_url']" t-att-target="task_link.get('target', '_self')">
202 <t t-out="task_link['title']"/>
203 </a>
204 </li>
205 </t>
206 </ul>
207 </div>
208
209 <div t-if="task.user_ids or task.partner_id" class="d-flex flex-column gap-4 mt-3">
210 <div t-if="task.user_ids">
211 <h6 class="flex-basis-100"><small class="text-muted">Assignees</small></h6>
212 <t t-foreach="task.user_ids" t-as="user">
213 <t t-call="portal.portal_my_contact">
214 <t t-set="_spacingClass" t-value="'mb-3' if len(task.user_ids) > 1 else ''"/>
215 <t t-set="_contactAvatar" t-value="image_data_uri(user.avatar_128)"/>
216 <t t-set="_contactName" t-value="user.name"/>
217 <div t-out="user" t-options='{"widget": "contact", "fields": ["email", "phone"]}'/>
218 </t>
219 </t>
220 </div>
221 <div class="col-12 d-flex flex-column" t-if="task.partner_id">
222 <h6><small class="text-muted">Customer</small></h6>
223 <t t-if="task.partner_id">
224 <t t-call="portal.portal_my_contact">
225 <t t-set="_contactAvatar" t-value="image_data_uri(task.partner_id.avatar_512)"/>
226 <t t-set="_contactName" t-value="task.partner_id.display_name"/>
227 <div t-field="task.partner_id" t-options='{"widget": "contact", "fields": ["email", "phone"]}'/>
228 </t>
229 </t>
230 </div>
231 </div>
232 </div>
233 </t>
234 </t>
235 <div id="task_content" class="o_portal_content col-12 col-lg-8 col-xxl-9">
236 <div id="card">
237 <div id="card_header" data-anchor="true">
238 <div class="row justify-content-between mb-3">
239 <div class="col-12 col-md-9">
240 <div class="d-flex gap-2">
241 <h3 class="my-0">
242 <span t-field="task.name"/>
243 <small class="text-muted d-none d-md-inline">(#<span t-field="task.id"/>)</small>
244 </h3>
245 </div>
246 </div>
247 <div class="col-auto">
248 <small class="text-end">Stage:</small>
249 <t t-call="project.portal_my_tasks_badge_widget_template"/>
250 </div>
251 </div>
252 </div>
253 <div id="card_body">
254 <div class="float-end">
255 <t t-call="project.portal_my_tasks_state_widget_template">
256 <t t-set="path" t-value="'task'"/>
257 </t>
258 </div>
259 <div class="row mb-4 container">
260 <div class="col-12 col-md-6 flex-grow-1">
261 <div t-if="project_accessible"><strong>Project:</strong> <a t-attf-href="/my/projects/#{task.project_id.id}" t-field="task.project_id"/></div>
262 <div t-else=""><strong>Project:</strong> <a t-field="task.project_id"/></div>
263 <div t-if="task.milestone_id and task.allow_milestones"><strong>Milestone:</strong> <span t-field="task.milestone_id"/></div>
264 <div>
265 <strong>Priority:</strong>
266 <t t-call="project.portal_my_tasks_priority_widget_template"/>
267 </div>
268 <div t-if="task.date_deadline"><strong>Deadline:</strong> <span t-field="task.date_deadline" t-options='{"widget": "datetime"}'/></div>
269 <div name="portal_my_task_allocated_hours">
270 <strong t-if="task.allocated_hours > 0">Allocated Time:</strong>
271 <t t-call="project.portal_my_task_allocated_hours_template"/>
272 </div>
273 </div>
274 <div class="col-12 col-md-6 d-empty-none" name="portal_my_task_second_column"></div>
275 </div>
276
277 <div class="row" t-if="task.description or task.attachment_ids">
278 <div t-if="not is_html_empty(task.description)" class="mb-4 mb-md-0">
279 <h5 class="mb-1">Description</h5>
280 <hr class="mt-1 mb-2"/>
281 <div class="py-1 px-2 bg-100 small overflow-auto table-responsive mb-4" t-field="task.description"/>
282 </div>
283 <div t-if="task.attachment_ids" class="o_project_portal_attachments">
284 <h5 class="mb-1">Attachments</h5>
285 <hr class="mt-1 mb-2"/>
286 <div class="row">
287 <t t-foreach="task.attachment_ids" t-as="attachment">
288 <div class="col-md-6">
289 <ul class="list-unstyled">
290 <li class="oe_attachments">
291 <a t-attf-href="/web/content/#{attachment.id}?download=true&amp;access_token=#{attachment.access_token}"
292 target="_blank" data-no-post-process="" class="d-flex align-items-center rounded bg-light p-2">
293 <div class='oe_attachment_embedded o_image o_image_small me-2 me-lg-3'
294 t-att-title="attachment.name" t-att-data-mimetype="attachment.mimetype"
295 t-attf-data-src="/web/image/#{attachment.id}/50x40?access_token=#{attachment.access_token}">
296 </div>
297 <div class='oe_attachment_name text-truncate'><t t-esc='attachment.name'/></div>
298 </a>
299 </li>
300 </ul>
301 </div>
302 </t>
303 </div>
304 </div>
305 </div>
306 </div>
307 </div>
308
309 <hr/>
310 <div id="task_chat" data-anchor="true">
311 <h3>Communication history</h3>
312 <t t-call="portal.message_thread">
313 <t t-set="token" t-value="task.access_token"/>
314 </t>
315 </div>
316 </div>
317 </div>
318 </xpath>
319 </template>
320
321 <template id="portal_my_task_allocated_hours_template">
322 <strong t-if="task.allocated_hours > 0" class="d-none">Allocated Time:</strong>
323 <span t-out="task.allocated_hours" t-options='{"widget": "float_time"}'/>
324 </template>
325 </odoo>