[IMP]project_working_time_task_portal:display billable hours only in project task portal

This commit is contained in:
2025-03-13 11:31:53 +01:00
parent 6e31ae3522
commit 224f69c104
5 changed files with 38 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
=============== ================================
project_working_time_task_portal project_working_time_task_portal
=============== ================================
add billable planned hours and billable remaining hours in the task portal view so the portal user only see billable timesheet lines add billable planned hours and billable remaining hours in the task portal view so the portal user only see billable timesheet lines

View File

@@ -3,7 +3,7 @@
{ {
"name": "project_working_time_task_portal", "name": "project_working_time_task_portal",
"version": "16.0.1.0.0", "version": "16.0.1.0.1",
"author": "Elabore", "author": "Elabore",
"website": "https://elabore.coop", "website": "https://elabore.coop",
"maintainer": "Boris Gallet", "maintainer": "Boris Gallet",
@@ -14,7 +14,8 @@
"depends": [ "depends": [
"base", "base",
"project", "project",
"sale_timesheet_line_exclude" "sale_timesheet_line_exclude",
"hr_timesheet",
], ],
"qweb": [], "qweb": [],
"external_dependencies": { "external_dependencies": {
@@ -23,7 +24,8 @@
# always loaded # always loaded
"data": [ "data": [
"views/hr_timesheet_portal.xml", "views/hr_timesheet_portal.xml",
"views/hr_timesheet_view_task_form2.xml" "views/hr_timesheet_view_task_form2.xml",
"views/portal_tasks_list.xml"
], ],
"assets": { "assets": {
"web.assets_frontend": [ "web.assets_frontend": [

View File

@@ -40,6 +40,10 @@ msgstr "Heures restantes:"
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form #: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form
msgid "Billable Remaining Hours" msgid "Billable Remaining Hours"
msgstr "Heures restantes facturables" msgstr "Heures restantes facturables"
#. module: project_working_time_task_portal
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.portal_tasks_list_inherit
msgid "Billable Hours"
msgstr "Heures facturables"
#. module: project_working_time_task_portal #. module: project_working_time_task_portal
#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form #: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form

View File

@@ -27,24 +27,17 @@
</template> </template>
<template id="portal_my_task_remaining_hours" name="My Task: remaining hours" inherit_id="hr_timesheet.portal_timesheet_table" priority="40"> <template id="portal_my_task_remaining_hours" name="My Task: remaining hours" inherit_id="hr_timesheet.portal_timesheet_table" priority="40">
<xpath expr="//tr[@t-foreach='timesheets']" position="attributes"> <xpath expr="//tr[@t-foreach='timesheets']" position="attributes">
<attribute name="t-if">not timesheet.exclude_from_sale_order</attribute> <attribute name="t-if">not timesheet.exclude_from_sale_order</attribute>
</xpath> </xpath>
<xpath expr="//tfoot/tr/th[last()]" position="replace">
<xpath expr="//tfoot/tr/th/span" position="replace"> <th class="text-end">
<span t-esc="round(sum(timesheets.filtered(lambda t: not t.exclude_from_sale_order).mapped('unit_amount')), 2)" <div t-esc="round(sum(timesheets.filtered(lambda t: not t.exclude_from_sale_order).mapped('unit_amount')), 2)"
t-options="{&quot;widget&quot;: &quot;float_time&quot;}"/> t-options="{&quot;widget&quot;: &quot;float_time&quot;}"/>
<div t-if="task.planned_hours > 0">Remaining Hours: <span t-field="task.billable_remaining_hours" t-options="{&quot;widget&quot;: &quot;float_time&quot;}"/></div>
</th>
</xpath> </xpath>
<xpath expr="//t[@t-name='hr_timesheet.portal_timesheet_table']/table/tfoot/tr" position="inside">
<t t-if="task.planned_hours > 0">
<tr>
<th colspan="3"/>
<th class="text-right">Remaining Hours: <span t-field="task.billable_remaining_hours" t-options="{&quot;widget&quot;: &quot;float_time&quot;}"/></th>
</tr>
</t>
</xpath>
</template> </template>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_tasks_list_inherit" inherit_id="project.portal_tasks_list">
<xpath expr="//thead/tr/th[7]" position="replace"/>
<xpath expr="//thead/tr/th[last()]" position="before">
<th t-if="not is_uom_day" class="text-end">Billable Hours</th>
</xpath>
<xpath expr="//tbody/t/tr/td[7]" position="replace"/>
<xpath expr="//tbody/t/tr/td[last()]" position="before">
<td class="text-end">
<t t-if="not is_uom_day">
<span t-field="task.billable_effective_hours"
t-options='{"widget": "float_time"}' />
<t t-if="task.planned_hours > 0"> / <span t-field="task.planned_hours"
t-options='{"widget": "float_time"}' />
</t>
</t>
</td>
</xpath>
</template>
</odoo>