Sélectionner une révision Git
cgscop_timesheet_sheet.xml 8,72 Kio
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!--
Vues
-->
<!-- Tree view -->
<record id="view_cgscop_timesheet_sheet_tree" model="ir.ui.view">
<field name="name">cgscop.timesheet.sheet.tree</field>
<field name="model">cgscop.timesheet.sheet</field>
<field name="arch" type="xml">
<tree string="Timesheet Reports" decoration-warning="state=='draft'">
<field name="name" />
<field name="employee_id"/>
<field name="create_date"/>
<field name="validation_date" />
<field name="total_hour" sum="Total"/>
<field name="state"/>
</tree>
</field>
</record>
<!-- Form view -->
<record id="view_cgscop_timesheet_sheet_form" model="ir.ui.view">
<field name="name">cgscop.timesheet.sheet.form</field>
<field name="model">cgscop.timesheet.sheet</field>
<field eval="25" name="priority"/>
<field name="arch" type="xml">
<form>
<header>
<button name="action_submit_timesheet" states="draft" string="Soumettre" type="object" class="oe_highlight"/>
<button name="approve_timesheet_sheets" states="submit" string="Valider" type="object" groups="hr_timesheet.group_timesheet_manager" class="oe_highlight"/>
<button name="print_timesheet" string="Imprimer" type="object" />
<button name="reset_timesheet_sheets" string="Remettre en brouillon" type="object" attrs="{'invisible': [('state', '=', 'draft')]}" groups="hr_timesheet.group_timesheet_manager"/>
<field name="state" widget="statusbar" statusbar_visible="draft,submit,valid"/>
</header>
<sheet>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" attrs="{'readonly': [('can_edit','=', False), ('state','!=', 'draft')]}"/>
</h1>
</div>
<group>
<group>
<field name="employee_id" groups="hr_timesheet.group_timesheet_manager" options="{'no_open': True, 'no_create': True}"/>
<field name="company_id" groups="base.group_multi_company" options="{'no_open': True, 'no_create': True}"/>
</group>
<group>
<field name="create_date" readonly="1"/>
<field name="submit_date" readonly="1"/>
<field name="validation_date" readonly="1"/>
<field name="total_hour" widget="float_time"/>
</group>
</group>
<field name="can_edit" invisible="1"/>
<field name="timesheet_line_ids" widget="many2many" domain="[('sheet_id', '=', False), ('employee_id', '=', employee_id)]" options="{'reload_on_button': True}" attrs="{'readonly': [('can_edit','=', False), ('state','!=', 'draft')]}" context="{'form_view_ref' : 'hr_timesheet.timesheet_view_form_user'}">
<tree editable="top">
<field name="date"/>
<field name="employee_id" readonly="1"/>
<field name="state" invisible="1"/>
<field name="sheet_id" invisible="1"/>
<field name="project_id" options="{'no_open': True, 'no_create': True}" />
<field name="partner_id" options="{'no_open': True, 'no_create': True}" />
<field name="name"/>
<field name="unit_amount" widget="float_time" />
<field name="ur_financial_system_id" options="{'no_open': True, 'no_create': True}" />
</tree>
</field>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="activity_ids" widget="mail_activity"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<!-- Search view -->
<record id="view_cgscop_timesheet_sheet_filter" model="ir.ui.view">
<field name="name">cgscop.timesheet.sheet.filter</field>
<field name="model">cgscop.timesheet.sheet</field>
<field name="arch" type="xml">
<search string="Feuille de temps">
<field name="name"/>
<field name="state"/>
<separator />
<field name="employee_id"/>
<filter string="Mes feuilles de temps" name="my_reports" domain="[('employee_id.user_id', '=', uid)]"/>
<filter string="Mon équipe" name="my_team_reports" domain="[('employee_id.parent_id.user_id', '=', uid)]" groups="hr_timesheet.group_timesheet_manager" help="Expenses of Your Team Member"/>
<separator />
<filter domain="[('state', '=', 'draft')]" string="Brouillon" name="draft" />
<filter domain="[('state', '=', 'submit')]" string="Soumis" name="submitted"/>
<filter domain="[('state', '=', 'valid')]" string="Validé" name="valid"/>
<group expand="0" string="Group By">
<filter string="Employé" name="employee" domain="[]" context="{'group_by': 'employee_id'}"/>
<filter string="Statut" domain="[]" context="{'group_by': 'state'}" name="state"/>
</group>
</search>
</field>
</record>
<!--
Actions
-->
<record id="action_cgscop_timesheet_sheet_my_all" model="ir.actions.act_window">
<field name="name">Mes feuilles de temps</field>
<field name="res_model">cgscop.timesheet.sheet</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_cgscop_timesheet_sheet_filter"/>
<field name="domain">[('employee_id.user_id', '=', uid)]</field>
<field name="context">{'search_default_my_reports': 1}</field>
</record>
<record id="action_cgscop_timesheet_sheet_to_approve" model="ir.actions.act_window">
<field name="name">Feuilles de temps à valider</field>
<field name="res_model">cgscop.timesheet.sheet</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_cgscop_timesheet_sheet_filter"/>
<field name="domain">[]</field>
<field name="context">{'search_default_submitted': 1}</field>
</record>
<record id="action_cgscop_timesheet_sheet_all" model="ir.actions.act_window">
<field name="name">Toutes les feuilles de temps</field>
<field name="res_model">cgscop.timesheet.sheet</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_cgscop_timesheet_sheet_filter"/>
<field name="domain">[('ur_id', '=', ur_id)]</field>
<field name="context">{}</field>
</record>
<!--
Menus
-->
<menuitem id="timesheet_sheet_menu"
parent="hr_timesheet.timesheet_menu_root"
name="Feuilles de temps"
sequence="25"/>
<menuitem id="menu_hr_timesheet_my_timesheet"
name="Mes feuilles de temps"
sequence="1"
action="cgscop_timesheet.action_cgscop_timesheet_sheet_my_all"
parent="cgscop_timesheet.timesheet_sheet_menu"/>
<menuitem id="menu_hr_timesheet_to_approve"
name="À valider"
sequence="1"
action="cgscop_timesheet.action_cgscop_timesheet_sheet_to_approve"
parent="cgscop_timesheet.timesheet_sheet_menu"
groups="hr_timesheet.group_timesheet_manager"/>
<menuitem id="menu_hr_timesheet_all"
name="Toutes les feuilles de temps"
sequence="1"
action="cgscop_timesheet.action_cgscop_timesheet_sheet_all"
parent="cgscop_timesheet.timesheet_sheet_menu"
groups="hr_timesheet.group_timesheet_manager"/>
</odoo>