Files
enterprise-addons/helpdesk_timesheet/views/helpdesk_ticket_views.xml
T

154 lines
9.6 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="helpdesk_ticket_view_form_inherit_helpdesk_timesheet" model="ir.ui.view">
<field name='name'>helpdesk.ticket.form.inherit.timesheet</field>
<field name="model">helpdesk.ticket</field>
<field name="priority">20</field>
<field name="inherit_id" ref="helpdesk.helpdesk_ticket_view_form"/>
<field name="arch" type="xml">
<field name="stage_id" position="before">
<field name="display_timesheet_timer" invisible="1"/>
<field name="encode_uom_in_days" invisible="1"/>
<button class="btn-primary" name="action_timer_start" type="object" string="Start" data-hotkey="z"
invisible="not display_timesheet_timer or timer_start or total_hours_spent"
groups="hr_timesheet.group_hr_timesheet_user"
/>
<button class="btn-secondary" name="action_timer_start" type="object" string="Start" data-hotkey="z"
invisible="not display_timesheet_timer or timer_start or not total_hours_spent"
groups="hr_timesheet.group_hr_timesheet_user"
/>
<button class="btn-primary o_fsm_stop" name="action_timer_stop" type="object" string="Stop" data-hotkey="z"
invisible="not display_timesheet_timer or not timer_start"
groups="hr_timesheet.group_hr_timesheet_user"
/>
<field name="timer_start" widget="timer_start_field" class="d-flex align-self-center me-auto ms-2 h2"
options="{'unit_amount_field': 'timesheet_unit_amount'}"
groups="hr_timesheet.group_hr_timesheet_user"
/>
</field>
<xpath expr="//field[@name='stage_id']" position="attributes">
<attribute name="class">ms-2</attribute>
</xpath>
<xpath expr="//field[@name='email_cc']" position="after">
<field name="use_helpdesk_timesheet" invisible="1"/>
<field name="project_id" invisible="1"/>
</xpath>
<xpath expr="//page[@name='extra_info']//field[@name='company_id']" position="after">
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" invisible="not use_helpdesk_timesheet"/>
</xpath>
<xpath expr="//page[@name='description']" position="after">
<page string="Timesheets" name="timesheets"
invisible="not project_id or not use_helpdesk_timesheet"
groups="hr_timesheet.group_hr_timesheet_user">
<field name='timesheet_ids' widget="timesheets_one2many" mode="list,kanban" context="{'default_project_id': project_id, 'form_view_ref': 'helpdesk_timesheet.timesheet_view_form_helpdesk'}">
<list editable="top" string="Timesheet Activities" decoration-muted="readonly_timesheet == True">
<field name="readonly_timesheet" column_invisible="True"/>
<field name="date" readonly="readonly_timesheet"/>
<field name="user_id" column_invisible="True"/>
<field name="employee_id" widget="many2one_avatar_employee" required="1" context="{'active_test': True}" readonly="readonly_timesheet"/>
<field name="name" required="0" readonly="readonly_timesheet"/>
<field name="unit_amount" string="Time Spent" widget="timesheet_uom" decoration-danger="unit_amount &gt; 24" readonly="readonly_timesheet"/>
<field name="project_id" column_invisible="True"/>
<field name="task_id" column_invisible="True"/>
<field name="company_id" column_invisible="True"/>
</list>
<kanban class="o_kanban_mobile">
<templates>
<t t-name="card" class="row g-0">
<field name="employee_id" class="col-6 fw-bolder" context="{'active_test': True}"/>
<field name="date" class="col-6 text-end fw-bolder"/>
<field name="name" class="col-6 text-muted"/>
<field name="unit_amount" widget="float_time" decoration-danger="unit_amount &gt; 24" class="col-6 text-end"/>
</t>
</templates>
</kanban>
<form string="Timesheet Activities">
<sheet>
<group>
<field name="readonly_timesheet" invisible="1"/>
<field name="date" readonly="readonly_timesheet"/>
<field name="user_id" invisible="1"/>
<field name="employee_id" required="1" context="{'active_test': True}" readonly="readonly_timesheet"/>
<field name="name" required="0" readonly="readonly_timesheet"/>
<field name="unit_amount" string="Time Spent" widget="float_time" decoration-danger="unit_amount &gt; 24" readonly="readonly_timesheet"/>
<field name="project_id" invisible="1"/>
<field name="company_id" invisible="1"/>
</group>
</sheet>
</form>
</field>
<group>
<group class="oe_subtotal_footer" name="ticket_hours">
<span>
<label class="fw-bold" for="total_hours_spent" string="Time Spent"
invisible="encode_uom_in_days"/>
<label class="fw-bold" for="total_hours_spent" string="Days Spent"
invisible="not encode_uom_in_days"/>
</span>
<field name="total_hours_spent" widget="timesheet_uom" nolabel="1" />
</group>
</group>
</page>
</xpath>
</field>
</record>
<!-- To restrict the teams to the ones with the timesheet feature activated when creating tickets on the fly -->
<record id="helpdesk_ticket_view_form_inherit_helpdesk_timesheet_restrict_teams" model="ir.ui.view">
<field name='name'>helpdesk.ticket.form.inherit.timesheet.restrict.teams</field>
<field name="model">helpdesk.ticket</field>
<field name="inherit_id" ref="helpdesk_timesheet.helpdesk_ticket_view_form_inherit_helpdesk_timesheet"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="team_id" position="attributes">
<attribute name="domain">[('use_helpdesk_timesheet', '=', True)]</attribute>
</field>
</field>
</record>
<record id="helpdesk_ticket_view_tree_inherit_helpdesk_timesheet" model="ir.ui.view">
<field name='name'>helpdesk.ticket.list.inherit.timesheet</field>
<field name="model">helpdesk.ticket</field>
<field name="priority">70</field>
<field name="inherit_id" ref="helpdesk.helpdesk_tickets_view_tree"/>
<field name="arch" type="xml">
<field name='partner_id' position="after">
<field name="total_hours_spent" widget="timesheet_uom" optional="hide" invisible="total_hours_spent == 0" sum="Total"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" options="{'no_quick_create': True}" optional="hide"/>
</field>
</field>
</record>
<record id="helpdesk_ticket_view_pivot_main_inherit_helpdesk_timesheet" model="ir.ui.view">
<field name='name'>helpdesk.ticket.pivot.inherit.timesheet</field>
<field name="model">helpdesk.ticket</field>
<field name="priority">70</field>
<field name="inherit_id" ref="helpdesk.helpdesk_ticket_view_pivot_main"/>
<field name="arch" type="xml">
<field name='assign_hours' position="after">
<field name="total_hours_spent" string="Time Spent (Timesheets)" widget="timesheet_uom"/>
</field>
</field>
</record>
<record id="helpdesk_ticket_view_graph_main_inherit_helpdesk_timesheet" model="ir.ui.view">
<field name='name'>helpdesk.ticket.graph.inherit.timesheet</field>
<field name="model">helpdesk.ticket</field>
<field name="priority">70</field>
<field name="inherit_id" ref="helpdesk.helpdesk_ticket_view_graph_main"/>
<field name="arch" type="xml">
<field name='assign_hours' position="after">
<field name="total_hours_spent" string="Time Spent (Timesheets)" widget="timesheet_uom"/>
</field>
</field>
</record>
<record id="project_project_action_view_helpdesk_tickets" model="ir.actions.act_window">
<field name="name">Tickets</field>
<field name="res_model">helpdesk.ticket</field>
<field name="view_mode">list,kanban,form,pivot,graph,activity</field>
<field name="context">{'default_project_id': active_id, 'create': False}</field>
<field name="domain">[('project_id', '=', active_id)]</field>
</record>
</odoo>