[MIG] project_working_time_task_portal: migrate to 16.0

This commit is contained in:
Stéphan Sainléger
2024-11-22 15:48:27 +01:00
parent 18d589848d
commit 872b889a88
11 changed files with 1014 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="portal_my_task_planned_hours" name="My Task: planned hours" inherit_id="hr_timesheet.portal_my_task" priority="40">
<xpath expr="//t[@t-call='hr_timesheet.portal_timesheet_table']" position="before">
<div class="row">
<div class="col-12 col-md-6 pb-2">
<span style="font-weight:bold;">Planned Hours: </span>
<span t-field="task.planned_hours" t-options="{&quot;widget&quot;: &quot;timesheet_uom_no_toggle&quot;}"/>
<t t-if="task.allow_subtasks and task.subtask_count > 0">
<div>
<strong>Subtask Planned Hours: </strong>
<span t-field="task.subtask_planned_hours" t-options="{&quot;widget&quot;: &quot;timesheet_uom_no_toggle&quot;}"/>
</div>
</t>
</div>
<t t-if="task.billable_progress > 0">
<div class="col-12 col-md-6 pb-2">
<strong>Progress: </strong>
<t t-set="progress" t-value="task.billable_progress"/>
<div class="oe-project_working_time_task_portal progressbar" t-attf-style="width: #{progress}%;">
<t t-esc="progress"/>%
</div>
</div>
</t>
</div>
</xpath>
</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)"
t-options="{&quot;widget&quot;: &quot;float_time&quot;}"/>
</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 id="portal_my_task_subtask_timesheet_table" name="My Task Subtask Timesheet Table: hide not billable" inherit_id="hr_timesheet.portal_subtask_timesheet_tables" priority="40"> -->
<!-- <xpath expr="//tr[@t-foreach='timesheets']" position="attributes"> -->
<!-- <attribute name="t-if">not timesheet.exclude_from_sale_order</attribute> -->
<!-- </xpath> -->
<!-- </template> -->
</odoo>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="project_working_time_view_task_form" model="ir.ui.view">
<field name="name">project.working.time.view.task.form</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="hr_timesheet.view_task_form2_inherited" />
<field name="priority" eval="99" />
<field name="arch" type="xml">
<xpath expr="//field[@name='effective_hours']" position="after">
<span>
<label class="font-weight-bold" for="billable_effective_hours" string="Billable Effective Hours" attrs="{'invisible': ['|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', True)]}"/>
<label class="font-weight-bold" for="billable_effective_hours" string="Billable Effective Days" attrs="{'invisible': ['|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', False)]}"/>
</span>
<field name="billable_effective_hours" widget="timesheet_uom" class="mt-2" attrs="{'invisible' : [('planned_hours', '=', 0.0)]}" nolabel="1"/>
<span>
<label class="font-weight-bold" for="non_billable_effective_hours" string="Non Billable Effective Hours" attrs="{'invisible': ['|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', True)]}"/>
<label class="font-weight-bold" for="non_billable_effective_hours" string="Non Billable Effective Days" attrs="{'invisible': ['|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', False)]}"/>
</span>
<field name="non_billable_effective_hours" widget="timesheet_uom" class="mt-2" attrs="{'invisible' : [('planned_hours', '=', 0.0)]}" nolabel="1"/>
</xpath>
<xpath expr="//field[@name='remaining_hours']" position="after">
<span>
<label class="font-weight-bold" for="billable_remaining_hours" string="Billable Remaining Hours" attrs="{'invisible': ['|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', True)]}"/>
<label class="font-weight-bold" for="billable_remaining_hours" string="Billable Remaining Days" attrs="{'invisible': ['|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', False)]}"/>
</span>
<field name="billable_remaining_hours" widget="timesheet_uom" class="oe_subtotal_footer_separator" attrs="{'invisible' : [('planned_hours', '=', 0.0)]}" nolabel="1"/>
</xpath>
</field>
</record>
</odoo>