[IMP] sale_timesheet: remove timesheets table in portal
In 14.0, we try to add a timesheets table in Invoice portal and Sales Order portal. Unfortunately, this table is not suitable for the use case. Because this table can be too long for the customer, it is better to redirect the user to the timesheets portal and filter these timesheets to have the ones that the user want to see. task-2424382
This commit is contained in:
@@ -7,126 +7,12 @@
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<!-- TODO: [XBO] Remove me in master -->
|
||||
<template id="portal_invoice_page_inherit_timesheet" inherit_id="account.portal_invoice_page">
|
||||
<xpath expr="//t[@t-call='portal.portal_record_sidebar']//div[hasclass('o_download_pdf')]" position="after">
|
||||
<t t-if="1 == 0">
|
||||
<li t-if="timesheets" class="list-group-item flex-grow-1" >
|
||||
<a href="#accordion">Timesheets</a>
|
||||
</li>
|
||||
</t>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//div[@id='invoice_content']//div[hasclass('o_portal_html_view')]" position="after">
|
||||
<t t-if="1 == 0">
|
||||
<div t-if="timesheets" class="container">
|
||||
<div id="accordion" class="o_timesheet_accordion mt-4">
|
||||
<div class="card mb-0">
|
||||
<div class="card-header">
|
||||
<h5 class="mb0">
|
||||
<a class="card-title" data-toggle="collapse" href="#collapseTimesheet">
|
||||
Timesheets
|
||||
</a>
|
||||
</h5>
|
||||
</div>
|
||||
<div id="collapseTimesheet" class="card-body show" data-parent="#accordion">
|
||||
<t t-set="nr_tasks" t-value="len(timesheets.mapped('task_id'))"/>
|
||||
<t t-set="nr_projects" t-value="len(timesheets.mapped('project_id'))"/>
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Employee</th>
|
||||
<th t-if="nr_projects > 1">Project</th>
|
||||
<th t-if="nr_tasks > 0">Task</th>
|
||||
<th>Description</th>
|
||||
<th t-if="timesheets[0]._is_timesheet_encode_uom_day()" class="text-right">Duration (days)</th>
|
||||
<th t-else="" class="text-right">Duration (hours)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr t-foreach="timesheets" t-as="timesheet">
|
||||
<td><t t-esc="timesheet.date" t-options='{"widget": "date"}'/></td>
|
||||
<td><t t-esc="timesheet.employee_id.name"/></td>
|
||||
<td t-if="nr_projects > 1"><span t-field="timesheet.project_id"/></td>
|
||||
<td t-if="nr_tasks > 0"><span t-field="timesheet.task_id"/></td>
|
||||
<td><t t-esc="timesheet.name"/></td>
|
||||
<td class="text-right">
|
||||
<span t-if="timesheet._is_timesheet_encode_uom_day()" t-esc="timesheet._get_timesheet_time_day()" t-options='{"widget": "timesheet_uom"}'/>
|
||||
<span t-else="" t-field="timesheet.unit_amount" t-options='{"widget": "float_time"}'/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="sale_order_portal_content_inherit" inherit_id="sale.sale_order_portal_content">
|
||||
<xpath expr="//td[@id='product_name']" position="inside">
|
||||
<a t-if="timesheets and len(timesheets.filtered(lambda t: t.so_line == line)) > 0" t-att-href="'/my/timesheets?search_in=sol_id&search=%s' % line.id">View Timesheets</a>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<!-- TODO: [XBO] Remove me in master -->
|
||||
<template id="sale_order_portal_template_inherit" inherit_id="sale.sale_order_portal_template">
|
||||
<xpath expr="//t[@t-call='portal.portal_record_sidebar']//div[hasclass('o_download_pdf')]" position="after">
|
||||
<t t-if="1 == 0">
|
||||
<li t-if="timesheets" class="list-group-item flex-grow-1" >
|
||||
<a href="#accordion">Timesheets</a>
|
||||
</li>
|
||||
</t>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//div[@id='sale_order_communication']" position="before">
|
||||
<t t-if="1 == 0">
|
||||
<div t-if="timesheets" class="container">
|
||||
<div id="accordion" class="o_timesheet_accordion mt-4">
|
||||
<div class="card mb-0">
|
||||
<div class="card-header">
|
||||
<h5 class="mb0">
|
||||
<a class="card-title" data-toggle="collapse" href="#collapseTimesheet">
|
||||
Timesheets
|
||||
</a>
|
||||
</h5>
|
||||
</div>
|
||||
<div id="collapseTimesheet" class="card-body show" data-parent="#accordion">
|
||||
<t t-set="nr_tasks" t-value="len(timesheets.mapped('task_id'))"/>
|
||||
<t t-set="nr_projects" t-value="len(timesheets.mapped('project_id'))"/>
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Employee</th>
|
||||
<th t-if="nr_projects > 1">Project</th>
|
||||
<th t-if="nr_tasks > 0">Task</th>
|
||||
<th>Description</th>
|
||||
<th t-if="timesheets[0]._is_timesheet_encode_uom_day()" class="text-right">Duration (days)</th>
|
||||
<th t-else="" class="text-right">Duration (hours)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr t-foreach="timesheets" t-as="timesheet">
|
||||
<td><t t-esc="timesheet.date" t-options='{"widget": "date"}'/></td>
|
||||
<td><t t-esc="timesheet.employee_id.name"/></td>
|
||||
<td t-if="nr_projects > 1"><span t-field="timesheet.project_id"/></td>
|
||||
<td t-if="nr_tasks > 0"><span t-field="timesheet.task_id"/></td>
|
||||
<td><t t-esc="timesheet.name"/></td>
|
||||
<td class="text-right">
|
||||
<span t-if="timesheet._is_timesheet_encode_uom_day()" t-esc="timesheet._get_timesheet_time_day()" t-options='{"widget": "timesheet_uom"}'/>
|
||||
<span t-else="" t-field="timesheet.unit_amount" t-options='{"widget": "float_time"}'/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="portal_my_timesheets_inherit" inherit_id="hr_timesheet.portal_my_timesheets">
|
||||
<xpath expr="//thead/tr[contains(@t-attf-class, 'thead-light')]" position="inside">
|
||||
<t t-elif="groupby == 'sol'">
|
||||
|
||||
Reference in New Issue
Block a user