| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<odoo> |
| 3 |
<record id="project_sharing_inherit_project_task_view_form" model="ir.ui.view"> |
| 4 |
<field name="name">project.sharing.project.task.view.form.inherit</field> |
| 5 |
<field name="model">project.task</field> |
| 6 |
<field name="priority">500</field> |
| 7 |
<field name="inherit_id" ref="project.project_sharing_project_task_view_form"/> |
| 8 |
<field name="arch" type="xml"> |
| 9 |
<xpath expr="//field[@name='child_ids']/list/field[@name='partner_id']" position="after"> |
| 10 |
<field name="allow_timesheets" column_invisible="1"/> |
| 11 |
</xpath> |
| 12 |
<xpath expr="//field[@name='depend_on_ids']/list/field[@name='partner_id']" position="after"> |
| 13 |
<field name="allow_timesheets" column_invisible="1"/> |
| 14 |
</xpath> |
| 15 |
<xpath expr="//field[@name='child_ids']/list/field[@name='portal_user_names']" position="after"> |
| 16 |
<field name="allocated_hours" widget="timesheet_uom_no_toggle" sum="Total Allocated Time" optional="hide" column_invisible="not parent.allow_timesheets" invisible="not allow_timesheets"/> |
| 17 |
<field name="effective_hours" widget="timesheet_uom" sum="Effective Hours" optional="hide" column_invisible="not parent.allow_timesheets" invisible="not allow_timesheets"/> |
| 18 |
<field name="subtask_effective_hours" string="Sub-tasks Time Spent" widget="timesheet_uom" sum="Sub-tasks Time Spent" optional="hide" column_invisible="not parent.allow_timesheets" invisible="not allow_timesheets"/> |
| 19 |
<field name="total_hours_spent" widget="timesheet_uom" sum="Total Time Spent" optional="hide" column_invisible="not parent.allow_timesheets" invisible="not allow_timesheets"/> |
| 20 |
<field name="remaining_hours" widget="timesheet_uom" sum="Time Remaining" optional="hide" decoration-danger="progress >= 1" decoration-warning="progress >= 0.8 and progress < 1" column_invisible="not parent.allow_timesheets" invisible="not allow_timesheets"/> |
| 21 |
<field name="progress" widget="project_task_progressbar" optional="hide" options="{'overflow_class': 'bg-danger'}" column_invisible="not parent.allow_timesheets" invisible="not allow_timesheets"/> |
| 22 |
</xpath> |
| 23 |
<xpath expr="//field[@name='depend_on_ids']/list/field[@name='portal_user_names']" position="after"> |
| 24 |
<field name="allocated_hours" widget="timesheet_uom_no_toggle" sum="Total Allocated Time" optional="hide" column_invisible="not parent.allow_timesheets" invisible="not allow_timesheets"/> |
| 25 |
<field name="effective_hours" widget="timesheet_uom" sum="Effective Hours" optional="hide" column_invisible="not parent.allow_timesheets" invisible="not allow_timesheets"/> |
| 26 |
<field name="subtask_effective_hours" string="Sub-tasks Time Spent" widget="timesheet_uom" sum="Sub-tasks Time Spent" optional="hide" column_invisible="not parent.allow_timesheets" invisible="not allow_timesheets"/> |
| 27 |
<field name="total_hours_spent" string="Total Time Spent" widget="timesheet_uom" sum="Total Time Spent" optional="hide" column_invisible="not parent.allow_timesheets" invisible="not allow_timesheets"/> |
| 28 |
<field name="remaining_hours" widget="timesheet_uom" sum="Time Remaining" optional="hide" decoration-danger="progress >= 1" decoration-warning="progress >= 0.8 and progress < 1" column_invisible="not parent.allow_timesheets" invisible="not allow_timesheets"/> |
| 29 |
<field name="progress" widget="project_task_progressbar" optional="hide" options="{'overflow_class': 'bg-danger'}" column_invisible="not parent.allow_timesheets" invisible="not allow_timesheets"/> |
| 30 |
</xpath> |
| 31 |
<xpath expr="//div[@name='repeat_intervals']" position="after"> |
| 32 |
<field name="encode_uom_in_days" invisible="1"/> |
| 33 |
<field name="subtask_count" invisible="1"/> |
| 34 |
<label for="allocated_hours" invisible="not allow_timesheets"/> |
| 35 |
<div id="allocated_hours_container" class="text-nowrap" invisible="not allow_timesheets"> |
| 36 |
<field name="allocated_hours" class="oe_inline" widget="float_time" readonly="1"/> |
| 37 |
<span invisible="subtask_count == 0"> |
| 38 |
(incl. <field name="subtask_allocated_hours" nolabel="1" widget="timesheet_uom_no_toggle" class="oe_inline"/> on |
| 39 |
<span class="fw-bold text-dark"> Sub-tasks</span>) |
| 40 |
</span> |
| 41 |
(<field name="progress" invisible="not project_id" class="oe_inline" nolabel="1" decoration-danger="progress > 1.005" digits="[1, 0]" widget="percentage"/>) |
| 42 |
</div> |
| 43 |
</xpath> |
| 44 |
<xpath expr="//notebook/page[@name='description_page']" position="after"> |
| 45 |
<field name="analytic_account_active" invisible="1"/> |
| 46 |
<field name="allow_timesheets" invisible="1"/> |
| 47 |
<page string="Timesheets" name="page_timesheets" id="timesheets_tab" invisible="not allow_timesheets"> |
| 48 |
<field name="timesheet_ids" mode="list,kanban" |
| 49 |
readonly="1"> |
| 50 |
<list string="Timesheet Activities" no_open="1" create="false" delete="0"> |
| 51 |
<field name="date"/> |
| 52 |
<field name="employee_id"/> |
| 53 |
<field name="name"/> |
| 54 |
<field name="unit_amount" string="Time Spent" widget="timesheet_uom" decoration-danger="unit_amount > 24"/> |
| 55 |
</list> |
| 56 |
<kanban class="o_kanban_mobile" action="action_open_timesheet_view_portal" type="object"> |
| 57 |
<templates> |
| 58 |
<t t-name="card" class="row g-0"> |
| 59 |
<field name="employee_id" class="col-6 fw-bold"/> |
| 60 |
<field name="date" class="col-6 text-end fw-bold" /> |
| 61 |
<field name="name" class="col-6 text-muted"/> |
| 62 |
<field name="unit_amount" widget="float_time" class="col-6 text-end"/> |
| 63 |
</t> |
| 64 |
</templates> |
| 65 |
</kanban> |
| 66 |
</field> |
| 67 |
<group invisible="not analytic_account_active"> |
| 68 |
<group class="oe_subtotal_footer" name="project_hours"> |
| 69 |
<span class="o_td_label float-start"> |
| 70 |
<label class="fw-bold" for="effective_hours" string="Time Spent"/> |
| 71 |
</span> |
| 72 |
<field name="effective_hours" widget="timesheet_uom" nolabel="1"/> |
| 73 |
<button name="action_view_subtask_timesheet" type="object" class="ps-0 border-0 oe_inline oe_link mb-2 o_td_label float-start" invisible="subtask_effective_hours == 0.0" context="{'is_project_sharing': True}"> |
| 74 |
<span class="text-nowrap">Time Spent on Sub-tasks:</span> |
| 75 |
</button> |
| 76 |
<field name="subtask_effective_hours" class="mt-2" widget="timesheet_uom" |
| 77 |
invisible="subtask_effective_hours == 0.0" nolabel="1"/> |
| 78 |
<span id="total_hours_spent_label" invisible="subtask_effective_hours == 0.0" class="o_td_label float-start"> |
| 79 |
<label class="fw-bold" for="total_hours_spent" string="Total Time Spent" |
| 80 |
invisible="encode_uom_in_days"/> |
| 81 |
<label class="fw-bold" for="total_hours_spent" string="Total Days Spent" |
| 82 |
invisible="not encode_uom_in_days"/> |
| 83 |
</span> |
| 84 |
<field name="total_hours_spent" widget="timesheet_uom" class="oe_subtotal_footer_separator" nolabel="1" |
| 85 |
invisible="subtask_effective_hours == 0.0" /> |
| 86 |
<span class="o_td_label float-start"> |
| 87 |
<label class="fw-bold" for="remaining_hours" string="Time Remaining" |
| 88 |
invisible="allocated_hours == 0.0 or encode_uom_in_days or remaining_hours < 0"/> |
| 89 |
<label class="fw-bold" for="remaining_hours" string="Days Remaining" |
| 90 |
invisible="allocated_hours == 0.0 or not encode_uom_in_days or remaining_hours < 0"/> |
| 91 |
<label class="fw-bold text-danger" for="remaining_hours" string="Time Remaining" |
| 92 |
invisible="allocated_hours == 0.0 or encode_uom_in_days or remaining_hours >= 0"/> |
| 93 |
<label class="fw-bold text-danger" for="remaining_hours" string="Days Remaining" |
| 94 |
invisible="allocated_hours == 0.0 or not encode_uom_in_days or remaining_hours >= 0"/> |
| 95 |
</span> |
| 96 |
<field name="remaining_hours" widget="timesheet_uom" class="oe_subtotal_footer_separator" |
| 97 |
invisible="allocated_hours == 0.0" nolabel="1"/> |
| 98 |
</group> |
| 99 |
</group> |
| 100 |
</page> |
| 101 |
</xpath> |
| 102 |
</field> |
| 103 |
</record> |
| 104 |
|
| 105 |
<record id="project_sharing_kanban_inherit_project_task_view_kanban" model="ir.ui.view"> |
| 106 |
<field name="name">project.sharing.project.task.timesheet.kanban.inherited</field> |
| 107 |
<field name="model">project.task</field> |
| 108 |
<field name="inherit_id" ref="project.project_sharing_project_task_view_kanban"/> |
| 109 |
<field name="arch" type="xml"> |
| 110 |
<templates position="before"> |
| 111 |
<field name="progress" /> |
| 112 |
<field name="remaining_hours" /> |
| 113 |
<field name="allocated_hours" /> |
| 114 |
<field name="allow_timesheets"/> |
| 115 |
<field name="encode_uom_in_days" invisible="1"/> |
| 116 |
</templates> |
| 117 |
<field name="priority" position="before"> |
| 118 |
<t name="allocated_hours" t-if="record.allocated_hours.raw_value > 0 and record.allow_timesheets.raw_value"> |
| 119 |
<t t-set="badge" t-value="'border border-success'"/> |
| 120 |
<t t-set="badge" t-value="'border border-warning'" t-if="record.progress.raw_value >= 0.8 and record.progress.raw_value <= 1"/> |
| 121 |
<t t-set="badge" t-value="'border border-danger'" t-if="record.remaining_hours.raw_value < 0"/> |
| 122 |
<t t-set="title" t-if="record.encode_uom_in_days.raw_value">Remaining days</t> |
| 123 |
<t t-set="title" t-else="">Time Remaining</t> |
| 124 |
<div t-attf-class="badge {{ badge }} bg-transparent flex-shrink-0" t-att-title="title"> |
| 125 |
<field name="remaining_hours" widget="timesheet_uom" /> |
| 126 |
</div> |
| 127 |
</t> |
| 128 |
</field> |
| 129 |
</field> |
| 130 |
</record> |
| 131 |
</odoo> |