Skip to content

Commit

Permalink
[IMP] sale_timesheet_timeline: Add table to order portal view
Browse files Browse the repository at this point in the history
TT50569
  • Loading branch information
pilarvargas-tecnativa authored and pedrobaeza committed Aug 21, 2024
1 parent 2fed61e commit 14e5f80
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 16 deletions.
7 changes: 7 additions & 0 deletions sale_timesheet_timeline/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ when confirming the order.

It includes a timeline view for pre-viewing and managing the planning.

In addition, this planning is shown in the order portal view.

**Table of contents**

.. contents::
Expand All @@ -51,6 +53,11 @@ Usage
#. You can also click on the "Planning" button and plan the dates visually in the
timeline view.

Known issues / Roadmap
======================

- Timeline visualization in portal.

Bug Tracker
===========

Expand Down
2 changes: 1 addition & 1 deletion sale_timesheet_timeline/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"installable": True,
"application": False,
"depends": ["sale_timesheet", "project_timeline"],
"data": ["views/sale_order_views.xml"],
"data": ["views/sale_order_views.xml", "views/sale_portal_templates.xml"],
}
33 changes: 30 additions & 3 deletions sale_timesheet_timeline/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-20 19:48+0000\n"
"PO-Revision-Date: 2024-08-20 19:48+0000\n"
"POT-Creation-Date: 2024-08-21 07:09+0000\n"
"PO-Revision-Date: 2024-08-21 09:11+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 3.0.1\n"

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.view_order_form
Expand All @@ -25,6 +27,21 @@ msgstr "<span class=\"o_stat_text\">Planificación</span>"
msgid "Any Service Line"
msgstr "Cualquier línea de servicio"

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Assignees"
msgstr "Asignados"

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "End"
msgstr "Fin"

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Planning"
msgstr "Planificación"

#. module: sale_timesheet_timeline
#: model:ir.model,name:sale_timesheet_timeline.model_sale_order
msgid "Sales Order"
Expand All @@ -40,6 +57,16 @@ msgstr "Línea de pedido de venta"
msgid "Sales Tasks Planning"
msgstr "Planificación de tareas de ventas"

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Start"
msgstr "Inicio"

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Task"
msgstr "Tarea"

#. module: sale_timesheet_timeline
#: model:ir.model.fields,field_description:sale_timesheet_timeline.field_sale_order_line__task_user_ids
msgid "Task Assignees"
Expand Down
29 changes: 27 additions & 2 deletions sale_timesheet_timeline/i18n/sale_timesheet_timeline.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-20 19:48+0000\n"
"PO-Revision-Date: 2024-08-20 19:48+0000\n"
"POT-Creation-Date: 2024-08-21 07:09+0000\n"
"PO-Revision-Date: 2024-08-21 07:09+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -25,6 +25,21 @@ msgstr ""
msgid "Any Service Line"
msgstr ""

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Assignees"
msgstr ""

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "End"
msgstr ""

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Planning"
msgstr ""

#. module: sale_timesheet_timeline
#: model:ir.model,name:sale_timesheet_timeline.model_sale_order
msgid "Sales Order"
Expand All @@ -40,6 +55,16 @@ msgstr ""
msgid "Sales Tasks Planning"
msgstr ""

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Start"
msgstr ""

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Task"
msgstr ""

#. module: sale_timesheet_timeline
#: model:ir.model.fields,field_description:sale_timesheet_timeline.field_sale_order_line__task_user_ids
msgid "Task Assignees"
Expand Down
2 changes: 2 additions & 0 deletions sale_timesheet_timeline/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ order lines that are services, and they are transferred to the created task (if
when confirming the order.

It includes a timeline view for pre-viewing and managing the planning.

In addition, this planning is shown in the order portal view.
1 change: 1 addition & 0 deletions sale_timesheet_timeline/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Timeline visualization in portal.
28 changes: 18 additions & 10 deletions sale_timesheet_timeline/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,17 @@ <h1 class="title">Dates planning in sales order lines</h1>
order lines that are services, and they are transferred to the created task (if any)
when confirming the order.</p>
<p>It includes a timeline view for pre-viewing and managing the planning.</p>
<p>In addition, this planning is shown in the order portal view.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-2">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
</ul>
</li>
</ul>
Expand All @@ -399,24 +401,30 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
timeline view.</li>
</ol>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>Timeline visualization in portal.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/timesheet/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/timesheet/issues/new?body=module:%20sale_timesheet_timeline%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul>
<li><p class="first"><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:</p>
<blockquote>
Expand All @@ -428,7 +436,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
Expand Down
72 changes: 72 additions & 0 deletions sale_timesheet_timeline/views/sale_portal_templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<odoo>
<template
id="sale_order_portal_content"
inherit_id="sale.sale_order_portal_content"
>
<xpath expr="//div[@id='total']" position="after">
<t
t-set="show_timeline"
t-value="lines_to_report.filtered(lambda x: x.task_date_start or x.task_date_end or x.task_user_ids)"
/>
<div t-if="show_timeline" id="timeline">
<h3>Planning</h3>
<table class="table table-sm" id="sales_order_planning_table">
<thead class="bg-100">
<tr>
<th class="text-start" id="product_name_header">Task</th>
<th class="text-center">Start</th>
<th class="text-center">End</th>
<th class="text-end">Assignees</th>
</tr>
</thead>
<tbody class="sale_tbody">
<t
t-set="sorted_lines"
t-value="sorted(lines_to_report, key=lambda l: (l.task_date_start is False and l.task_date_end is False, l.task_date_start is not False, l.task_date_start or l.task_date_end))"
/>
<t t-foreach="sorted_lines" t-as="line">
<t
t-set="show_line"
t-value="line.task_date_start or line.task_date_end or line.task_user_ids"
/>
<tr
t-if="show_line"
t-att-class="'bg-200 fw-bold o_line_section' if line.display_type == 'line_section' else 'fst-italic o_line_note' if line.display_type == 'line_note' else ''"
>
<t t-if="not line.display_type">
<t t-set="name" t-value="line.name.split('\n')" />
<td id="name">
<span
t-esc="name[0] + ' ' + name[1] if len(name) > 1 else name[0]"
/>
</td>
<td class="text-center">
<div id="date_start">
<span
t-field="line.task_date_start"
t-options='{"widget": "date"}'
/>
</div>
</td>
<td class="text-center">
<div id="date_end">
<span
t-field="line.task_date_end"
t-options='{"widget": "date"}'
/>
</div>
</td>
<td class="text-end">
<div id="user_ids">
<span t-field="line.task_user_ids" />
</div>
</td>
</t>
</tr>
</t>
</tbody>
</table>
</div>
</xpath>
</template>
</odoo>

0 comments on commit 14e5f80

Please sign in to comment.