[ADD]hr_employee_stats_sheet

This commit is contained in:
2025-09-17 11:08:21 +02:00
parent e8a819d594
commit 551831f81f
17 changed files with 1462 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
<odoo>
<record id="view_hr_employee_stats_tree" model="ir.ui.view">
<field name="name">hr.employee.stats.tree</field>
<field name="model">hr.employee.stats</field>
<field name="arch" type="xml">
<tree name="Employee time stats" editable="top" decoration-muted="dayofweek in [5,6] or is_public_holiday">
<field name="name"/>
<field name="date"/>
<field name="employee_id"/>
<field name="total_hours" widget="float_time" sum="Total"/>
<field name="total_leave_hours" widget="float_time" sum="Total"/>
<field name="total_recovery_hours" widget="float_time" sum="Total"/>
<field name="total_planned_hours" widget="float_time" sum="Total"/>
<field name="gap_hours" widget="float_time" sum="Total"/>
<field name="dayofweek" invisible="1"/>
<field name="is_public_holiday" invisible="1"/>
</tree>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,78 @@
<odoo>
<data>
<!-- Ajout d'une vue tree pour les stats dans la timesheet_sheet -->
<record id="view_hr_timesheet_sheet_form_inherit" model="ir.ui.view">
<field name="name">hr.timesheet.sheet.form.inherit</field>
<field name="model">hr_timesheet.sheet</field>
<field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form"/>
<field name="arch" type="xml">
<group name="dates" position="inside">
<field name="timesheet_sheet_gap_hours" string="Total gap hours in this timesheet sheet time range" widget="float_time"/>
<field name="timesheet_sheet_recovery_hours" string="Total recovery hours in this timesheet sheet time range" widget="float_time" style="font-weight: bold"/>
<button
colspan="2"
class="oe_highlight"
name="action_generate_recovery_allocation"
string='Create recovery allocation'
type='object'
attrs="{'invisible': ['|', ('can_review', '=', False),
('state', '!=', 'done'),
('timesheet_sheet_recovery_hours', '=', 0)]}"
/>
</group>
<xpath expr="//notebook" position="inside">
<page string="Employee Stats">
<field name="employee_stats_ids" no_label="1" readonly="1"/>
</page>
<page string="Generated recovery allocations">
<field name="recovery_allocation_ids" no_label="1" readonly="1"/>
</page>
</xpath>
</field>
</record>
<record id="hr_timesheet_sheet_stats_overview_pivot_view" model="ir.ui.view">
<field name="name">hr.timesheet.sheet.stats.overview.pivot.view</field>
<field name="model">hr_timesheet.sheet</field>
<field name="arch" type="xml">
<pivot string="Employee time stats pivot" sample="1">
<field name="employee_id" type="row"/>
</pivot>
</field>
</record>
<!-- Ajout d'une vue heure d'écart et récup sur la vue tree des hr_timesheet.sheet -->
<record id="view_hr_timesheet_sheet_tree_stats_inherit" model="ir.ui.view">
<field name="name">hr.timesheet.sheet.tree.stats.inherit</field>
<field name="model">hr_timesheet.sheet</field>
<field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_tree" />
<field name="arch" type="xml">
<field name="department_id" position="after">
<field name="timesheet_sheet_gap_hours" string="Heures d'écart" optional="show" widget="float_time" />
<field name="timesheet_sheet_recovery_hours" string="Heures de récupération" optional="hide" widget="float_time" />
</field>
</field>
</record>
<!-- Ajout d'une vue pivot pour hr_timesheet.sheet -->
<!-- <record id="hr_timesheet_sheet_pivot" model="ir.ui.view">
<field name="name">hr.timesheet.sheet.pivot</field>
<field name="model">hr_timesheet.sheet</field>
<field name="arch" type="xml">
<pivot string="Timesheet Sheets Analysis">
<field name="employee_id" type="row"/>
<field name="department_id"/>
<field name="reviewer_id"/>
<field name="state"/>
<field name="date_start" type="row"/>
<field name="date_end"/>
<field name="total_time" type="measure" />
</pivot>
</field>
</record> -->
<!-- Ajout de la vue pivot à l'action "All Timesheet Sheets" -->
<!-- <record id="act_hr_timesheet_sheet_all_timesheets_pivot" model="ir.actions.act_window.view">
<field name="view_mode">pivot</field>
<field name="sequence" eval="10"/>
<field name="view_id" ref="hr_timesheet_sheet_pivot"/>
<field name="act_window_id" ref="hr_timesheet_sheet.act_hr_timesheet_sheet_all_timesheets"/>
</record> -->
</data>
</odoo>

View File

@@ -0,0 +1,60 @@
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.hr.timesheet</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="55" />
<field name="inherit_id" ref="hr_timesheet.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@name='hr_timesheet_sheet']" position="inside">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_right_pane">
<label for="recovery_type_id"/>
<span
class="fa fa-lg fa-building"
title="Values set here are company-specific."
aria-label="Values set here are company-specific."
groups="base.group_multi_company"
role="img"
/>
<div class="text-muted">
Choose the recovery type.
</div>
<div class="content-group">
<div class="mb16">
<field
name="recovery_type_id"
class="o_light_label"
widget="selection"
required="1"
/>
</div>
</div>
<div class="text-muted">
Choose the coef to apply to recovery hours.
</div >
<div class="content-group">
<div class="mb16">
<field
name="coef"
class="o_light_label"
widget="float"
/> %
</div>
</div>
<div class="text-muted">
Choose to auto-validate the recovery allocation or not
</div>
<div class="content-group">
<div class="mb16">
<field
name="auto_validate_recovery_allocation"
widget="boolean_toggle"
/>
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>