[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

@@ -27,24 +27,17 @@
</template>
<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">
<attribute name="t-if">not timesheet.exclude_from_sale_order</attribute>
</xpath>
<xpath expr="//tfoot/tr/th/span" position="replace">
<span t-esc="round(sum(timesheets.filtered(lambda t: not t.exclude_from_sale_order).mapped('unit_amount')), 2)"
<xpath expr="//tfoot/tr/th[last()]" position="replace">
<th class="text-end">
<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;}"/>
<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 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>

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>