<?xml version="1.0" encoding="utf-8"?>
<odoo>
        <record id="view_order_form_inherit_sale_timesheet" model="ir.ui.view">
            <field name="name">sale.order.form.sale.timesheet</field>
            <field name="model">sale.order</field>
            <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
                <data>
                   <xpath expr="//button[@name='action_view_invoice']" position="before">
                       <button type="object"
                           name="action_view_timesheet"
                           class="oe_stat_button"
                           icon="fa-clock-o"
                           attrs="{'invisible': [('timesheet_count', '=', 0)]}"
                           groups="hr_timesheet.group_hr_timesheet_user">
                           <field name="timesheet_count" widget="statinfo" string="Timesheets"/>
                       </button>
                    </xpath>
                    <xpath expr="//button[@name='action_view_invoice']" position="before">
                       <button type="object"
                           name="action_view_project_ids"
                           class="oe_stat_button"
                           icon="fa-puzzle-piece"
                           string="Project(s) Overview"
                           attrs="{'invisible': [('project_ids', '=', [])]}"
                           groups="project.group_project_manager">
                          <field name="project_ids" invisible="1"/>
                       </button>
                    </xpath>
                    <xpath expr="//button[@name='action_view_invoice']" position="before">
                       <button type="object"
                           name="action_view_task"
                           class="oe_stat_button"
                           icon="fa-tasks"
                           attrs="{'invisible': [('tasks_count', '=', 0)]}"
                           groups="project.group_project_user">
                           <field name="tasks_count" widget="statinfo" string="Tasks"/>
                       </button>
                    </xpath>
                </data>
           </field>
        </record>
</odoo>
