19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:31:00 +01:00
parent a1137a1456
commit e1d89e11e3
2789 changed files with 1093187 additions and 605897 deletions

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_calendar_event_form_inherit" model="ir.ui.view">
<field name="name">view.calendar.event.form.inherit</field>
<field name="model">calendar.event</field>
<field name="inherit_id" ref="calendar.view_calendar_event_form"/>
<field name="arch" type="xml">
<xpath expr="//label[@for='videocall_location']" position="attributes">
<attribute name="invisible" add="res_model == 'hr.leave'" separator=" or "/>
</xpath>
<xpath expr="//div[@name='videocall_location_div']" position="attributes">
<attribute name="invisible" add="res_model == 'hr.leave'" separator=" or "/>
</xpath>
</field>
</record>
</odoo>

View file

@ -5,12 +5,12 @@
name="Time Off"
id="menu_hr_holidays_root"
sequence="225"
web_icon="hr_holidays,static/description/icon.svg"
web_icon="hr_holidays,static/description/icon.png"
groups="base.group_user"/>
<menuitem
id="menu_hr_holidays_my_leaves"
name="My Time Off"
name="My Time"
parent="menu_hr_holidays_root"
sequence="1"/>
@ -41,8 +41,8 @@
action="action_hr_holidays_dashboard"/>
<menuitem
id="menu_hr_holidays_approvals"
name="Approvals"
id="menu_hr_holidays_management"
name="Management"
parent="menu_hr_holidays_root"
sequence="3"
groups="hr_holidays.group_hr_holidays_responsible"/>
@ -50,16 +50,16 @@
<menuitem
id="menu_open_department_leave_approve"
name="Time Off"
parent="menu_hr_holidays_approvals"
parent="menu_hr_holidays_management"
action="hr_leave_action_action_approve_department"
sequence="1"/>
sequence="5"/>
<menuitem
id="hr_holidays_menu_manager_approve_allocations"
name="Allocations"
parent="menu_hr_holidays_approvals"
parent="menu_hr_holidays_management"
action="hr_leave_allocation_action_approve_department"
sequence="2"/>
sequence="15"/>
<menuitem
id="menu_hr_holidays_report"
@ -79,8 +79,16 @@
id="menu_hr_holidays_summary_all"
name="by Type"
parent="menu_hr_holidays_report"
action="act_hr_employee_holiday_request"
action="action_hr_leave_report"
sequence="3"/>
<menuitem
id="menu_hr_holidays_balance"
name="Balance"
parent="menu_hr_holidays_report"
action="action_hr_holidays_by_employee_and_type_report"
groups="hr_holidays.group_hr_holidays_manager"
sequence="4"/>
<menuitem
id="menu_hr_holidays_configuration"
@ -114,9 +122,9 @@
sequence="3"/>
<menuitem
id="hr_holidays_stress_day_menu_configuration"
action="hr_leave_stress_day_action"
name="Stress Days"
id="hr_holidays_mandatory_day_menu_configuration"
action="hr_leave_mandatory_day_action"
name="Mandatory Days"
parent="menu_hr_holidays_configuration"
groups="hr_holidays.group_hr_holidays_manager"
sequence="4"/>

View file

@ -6,198 +6,250 @@
<field name="arch" type="xml">
<form string="Accrual Level">
<sheet>
<group>
<field name="sequence" invisible="1" force_save="1"/>
<label for="start_count"/>
<div class="o_col">
<div class="o_row">
<field name="start_count"/>
<field name="start_type" nolabel="1"/><label for="start_type" string="after allocation date" class="o_form_label"/>
</div>
</div>
<field name="is_based_on_worked_time"/>
<label for="added_value"/>
<div class="o_col">
<div class="o_row">
<field name="added_value"/>
<field name="added_value_type" nolabel="1"/>
</div>
</div>
<label for="frequency"/>
<div class="o_col">
<field name="frequency"/>
<div class="o_row" attrs="{'invisible': [('frequency', '!=', 'weekly')]}">
<label for="week_day" string="on"/><field name="week_day"/>
</div>
<div class="o_row" attrs="{'invisible': [('frequency', '!=', 'monthly')]}">
<label for="first_day_display" string="on the"/><field name="first_day_display" required="1"/> of the month
</div>
<div class="o_row" attrs="{'invisible': [('frequency', '!=', 'bimonthly')]}">
<label for="first_day_display" string="on the"/><field name="first_day_display" required="1"/> and on the <field name="second_day_display" required="1"/> of the month
</div>
<div class="o_row" attrs="{'invisible': [('frequency', '!=', 'biyearly')]}">
<label for="first_month_day_display" string="on the"/><field name="first_month_day_display" required="1"/> of <field name="first_month"/> and on the <field name="second_month_day_display" required="1"/> of <field name="second_month"/>
</div>
<div class="o_row" attrs="{'invisible': [('frequency', '!=', 'yearly')]}">
<label for="yearly_day_display" string="on the"/><field name="yearly_day_display" required="1"/> of <field name="yearly_month" class="w-25"/>
</div>
</div>
<label for="maximum_leave"/>
<div class="o_col">
<div class="o_row">
<field name="maximum_leave"/>
<!-- force_save is required here since it would otherwise not be saved due to the readonly
there is an issue when the field is present twice in the view. -->
<field name="added_value_type" nolabel="1" readonly="1" force_save="1"/>
</div>
</div>
<field name="action_with_unused_accruals" style="width: 40%"/>
<field name="postpone_max_days" attrs="{'invisible': [('action_with_unused_accruals', '!=', 'postponed')]}"/>
</group>
<div colspan="2">
<field name="can_modify_value_type" invisible="1"/>
</div>
<div class="o_accrual_level_form">
<group class="o_accrual" string="Accrual Level Options">
<label class="fw-bold" for="added_value" string="Set the employee accrual frequency :"/>
<span>
<field nolabel="1" class="me-1 o_field_accrual" name="added_value"
widget="float_without_trailing_zeros"/>
<field nolabel="1" class="me-1 o_field_accrual" name="added_value_type"
readonly="not can_modify_value_type"/>
<field nolabel="1" class="o_field_accrual" name="frequency"/>
<span name="weekly" invisible="frequency != 'weekly'">
on
<field nolabel="1" name="week_day" class="o_field_accrual" required="frequency == 'weekly'" placeholder="select a weekday"/>
</span>
<span name="monthly" invisible="frequency != 'monthly'">
on the
<field nolabel="1" name="first_day" class="o_field_accrual" required="frequency == 'monthly'" placeholder="select a day"/>
of the month.
</span>
<span name="bimonthly" invisible="frequency != 'bimonthly'" style="width: 100%">
on the
<field nolabel="1" name="first_day" class="o_field_accrual" required="frequency == 'bimonthly'" placeholder="select a day"/>
and the
<field nolabel="1" name="second_day" class="o_field_accrual" required="frequency == 'bimonthly'" placeholder="select a day"/>
of the month
</span>
<span name="biyearly" invisible="frequency != 'biyearly'">
on the
<field nolabel="1" name="first_month_day" class="o_field_accrual" widget="day_selection" month_field="first_month" placeholder="select a day" required="frequency == 'biyearly'"/>
of
<field name="first_month" class="o_field_accrual" placeholder="select a month" required="frequency == 'biyearly'"/>
and the
<field nolabel="1" name="second_month_day" class="o_field_accrual" widget="day_selection" month_field="second_month" placeholder="select a day" required="frequency == 'biyearly'"/>
of
<field nolabel="1" name="second_month" class="o_field_accrual" placeholder="select a month" required="frequency == 'biyearly'"/>
</span>
<span name="yearly" invisible="frequency != 'yearly'">
on the
<field nolabel="1" name="yearly_day" class="o_field_accrual" widget="day_selection" month_field="yearly_month" required="frequency == 'yearly'" placeholder="select a day"/>
of
<field nolabel="1" name="yearly_month" class="o_field_accrual" required="frequency == 'yearly'" placeholder="select a month"/>
</span>
</span>
<label class="fw-bold" for="milestone_date" string="This milestone will be reached :"/>
<span name="milestone_date">
<field nolabel="1" class="ms-1" name="milestone_date"
widget="radio_followed_by_element"
options="{'links': {'after': 'milestone_date_after'}, 'observe': 'milestone_date'}"/>
<span id="milestone_date_after">
<field nolabel="1" class="ms-1 me-1 o_field_accrual" name="start_count"/>
<field nolabel="1" class="me-1 o_field_accrual" name="start_type"/>
from the start of allocation
</span>
</span>
</group>
<group class="o_accrual" invisible="not can_be_carryover" string="Carry Over Options">
<label class="fw-bold" for="action_with_unused_accruals" string="After a year, unused time off will be :"/>
<span>
<span name="unused_accruals">
<field nolabel="1" class="ms-1" name="action_with_unused_accruals"
widget="radio"
readonly="not can_be_carryover"/>
</span>
</span>
<label class="fw-bold" invisible="action_with_unused_accruals == 'lost'" for="carryover_options" string="How much time can be carried over :"/>
<span invisible="action_with_unused_accruals == 'lost'" id="unused_accruals_all">
<span name="carryover_options">
<field nolabel="1" class="ms-1" name="carryover_options"
widget="radio_followed_by_element"
options="{'links': {'limited': 'carryover_options_limited'}, 'observe': 'carryover_options'}"/>
<span id="carryover_options_limited" readonly="1">
<field nolabel="1" class="ms-1 me-1 o_field_accrual" name="postpone_max_days"/>
<field nolabel="1" class="o_field_accrual" name="added_value_type" readonly="1"/>
</span>
</span>
</span>
<label class="fw-bold" invisible="action_with_unused_accruals == 'lost'" for="accrual_validity" string="Define a carry over validity?"/>
<span invisible="action_with_unused_accruals == 'lost'" class="d-flex">
<field nolabel="1" class="ms-1" name="accrual_validity"/>
<span invisible="not accrual_validity">
The days carried over will be effective for
<field nolabel="1" class="me-1 o_field_accrual" name="accrual_validity_count"/>
<field nolabel="1" class="me-1 o_field_accrual" name="accrual_validity_type"/>
</span>
</span>
</group>
<group string="Cap Options" class="o_accrual">
<label class="fw-bold" for="cap_accrued_time_yearly" string="Define a yearly cap?"/>
<span>
<field nolabel="1" class="ms-1" name="cap_accrued_time_yearly"/>
<span invisible="not cap_accrued_time_yearly">
Accrual will stop until next carry-over date if accrued time's reach
<field nolabel="1" class="me-1 o_field_accrual" name="maximum_leave_yearly"
widget="float_without_trailing_zeros"/>
<field nolabel="1" class="o_field_accrual" name="added_value_type" readonly="1"/>.
</span>
</span>
<label class="fw-bold" for="cap_accrued_time" string="Define a balance cap?"/>
<span>
<field nolabel="1" class="ms-1" name="cap_accrued_time"/>
<span invisible="not cap_accrued_time">
The plan will be on hold if the balance reach
<field nolabel="1" class="me-1 o_field_accrual" name="maximum_leave"
widget="float_without_trailing_zeros"/>
<field nolabel="1" class="o_field_accrual" name="added_value_type" readonly="1"/> of available time.
</span>
</span>
</group>
</div>
</sheet>
<footer>
<button string="Save" type="object" special="save" class="btn btn-primary"/>
<button string="Save &amp; New" type="object" name="action_save_new" class="btn btn-primary"
invisible="not context.get('new')"/>
<button string="Discard" special="cancel" class="btn btn-secondary"/>
<button string="Delete" type="object" name="unlink" class="btn btn-danger ms-auto"
invisible="context.get('new')"/>
</footer>
</form>
</field>
</record>
<record id="hr_accrual_plan_view_tree" model="ir.ui.view">
<field name="name">hr.leave.accrual.plan.tree</field>
<field name="name">hr.leave.accrual.plan.list</field>
<field name="model">hr.leave.accrual.plan</field>
<field name="arch" type="xml">
<tree string="Accrual Plans">
<list string="Accrual Plans" sample="1">
<field name="name"/>
<field name="level_count"/>
<field name="time_off_type_id"/>
<field name="employees_count"/>
</tree>
</list>
</field>
</record>
<record id="hr_accrual_plan_view_form" model="ir.ui.view">
<field name="name">hr.leave.accrual.plan.form</field>
<field name="model">hr.leave.accrual.plan</field>
<field name="arch" type="xml">
<form string="Accrual Plan">
<field name="show_transition_mode" invisible="1" />
<form string="Accrual Plan" class="o_accrual_plan_form">
<field name="active" invisible="1"/>
<field name="show_transition_mode" invisible="1"/>
<sheet>
<div class="oe_button_box" name="button_box" attrs="{'invisible': [('id', '=', False)]}">
<button name="action_open_accrual_plan_employees" type="object" class="oe_stat_button" icon="fa-users">
<div class="oe_button_box" name="button_box" invisible="not id">
<button name="action_open_accrual_plan_employees" type="object" class="oe_stat_button"
icon="fa-users" invisible="employees_count == 0" groups="hr.group_hr_user">
<field name="employees_count" widget="statinfo"/>
</button>
</div>
<group>
<group>
<field name="name"/>
</group>
<group>
<field name="time_off_type_id"/>
</group>
<group>
<field name="transition_mode" widget="radio" attrs="{'invisible': [('show_transition_mode', '=', False)]}"/>
</group>
</group>
<span class="oe_grey" invisible="1">
</span>
<div class="o_hr_holidays_hierarchy">
<div class="o_hr_holidays_title">Rules</div>
<div class="o_hr_holidays_hierarchy_readonly" attrs="{'invisible': [('level_ids', '!=', [])]}">
<p>
No rule has been set up for this accrual plan.
</p>
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" invisible="active"/>
<div>
<div class="d-flex flex-direction-row o_accrual_plan_settings">
<div class="w-100">
<div class="oe_title w-50">
<label class="fw-bold" for="name" string="Title"/>
<h1><field name="name" placeholder="e.g. Seniority Plan, PTO, RTT, ..." required="id"/></h1>
<group groups="base.group_multi_company">
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company" placeholder="Visible to all"/>
</group>
</div>
<group string="Configuration" class="mt-0 o_accrual">
<label class="fw-bold" for="accrued_gain_time" string="When the time is accrued?"/>
<field nolabel="1" class="ms-1" name="accrued_gain_time" widget="radio"/>
<label class="fw-bold" invisible="accrued_gain_time == 'start'" for="is_based_on_worked_time" string="It is based on worked time?"/>
<span invisible="accrued_gain_time == 'start'">
<field class="o_field_radio ms-1" name="is_based_on_worked_time" widget="boolean_radio" options="{
'yes_label_element_id': 'is_based_on_worked_time_yes',
'no_label_element_id': 'is_based_on_worked_time_no'
}" readonly="accrued_gain_time == 'start'"/>
<template id="is_based_on_worked_time_yes">Yes, consider the worked hours, excluding any time off taken during that period.
</template>
<template id="is_based_on_worked_time_no">No, always consider the entire accrual period (whole calendar days).
</template>
</span>
<label class="fw-bold" for="can_be_carryover"
string="Do you need a carry-over of the accrued days from one year to another?"/>
<span>
<field class="ms-1" name="can_be_carryover"/>
</span>
<label class="fw-bold" invisible="not can_be_carryover" for="carryover_date"
string="When do you want the accrued time left to be carried-over?"/>
<span name="carryover" invisible="not can_be_carryover">
<field class="ms-1" name="carryover_date"
widget="radio_followed_by_element"
options="{'links': {'other': 'carryover_custom_date'}, 'observe': 'carryover'}"/>
<span id="carryover_custom_date">
: the
<field name="carryover_day" widget="day_selection" month_field="carryover_month" placeholder="select a day"
required="carryover_date == 'other'"/>
of
<field name="carryover_month" placeholder="select a month"
required="carryover_date == 'other'"/>
</span>
</span>
<label class="fw-bold" invisible="not show_transition_mode" for="transition_mode" string="Switch employees to the new accrual level:"/>
<span invisible="not show_transition_mode">
<field class="ms-1" name="transition_mode" widget="radio"/>
</span>
</group>
</div>
</div>
<field name="level_ids" mode="kanban" nolabel="1"
class="o_hr_holidays_plan_level_container o_hr_holidays_plan_level_hierarchy"
add-label="Add a new level"
>
<kanban default_order="sequence">
<field name="sequence"/>
<field name="start_count"/>
<field name="start_type"/>
<field name="added_value"/>
<field name="added_value_type"/>
<field name="frequency"/>
<field name="week_day"/>
<field name="first_day"/>
<field name="second_day"/>
<field name="first_month_day"/>
<field name="first_month"/>
<field name="second_month_day"/>
<field name="second_month"/>
<field name="yearly_day"/>
<field name="yearly_month"/>
<field name="maximum_leave"/>
<field name="action_with_unused_accruals"/>
<field name="is_based_on_worked_time"/>
<templates>
<div t-name="kanban-box" class="border-0 bg-transparent">
<div class="o_hr_holidays_body oe_kanban_global_click">
<div class="o_hr_holidays_timeline text-center">
Level <span class="o_hr_holidays_plan_level_level"/>
</div>
<t t-if="!read_only_mode">
<a type="edit" t-attf-class="oe_kanban_action oe_kanban_action_a text-black">
<t t-call="level_content"/>
</a>
</t>
<t t-else="">
<t t-call="level_content"/>
</t>
</div>
<div class="o_accrual_plan_levels border rounded-3 d-flex mt-2 flex-direction-column align-items-center flex-1 overflow-hidden">
<div class="o_accrual_levels_scrollable w-100 h-100 d-flex align-content-center">
<div class="o_view_nocontent top-0" style="position: relative;" invisible="level_ids">
<div class="o_nocontent_help">
<p class="o_view_nocontent_smiling_face">
No milestones on the plan yet. Let's create a new one
</p>
<button name="action_create_accrual_plan_level" type="object"
class="btn btn-primary"
string="Create a milestone"/>
</div>
<t t-name="level_content">
<div class="o_hr_holidays_card">
<div class="content">
<div>
<t t-if="record.start_count.value > 0">
Starts <field name="start_count" widget="integer"/> <field name="start_type"/> after allocation start date
</t>
<t t-else="">
Starts immediately after allocation start date
</t>
</div>
<div>
Adds <field name="added_value" widget="float_without_trailing_zeros"/> <field name="added_value_type"/>
<t t-if="record.is_based_on_worked_time.raw_value">(based on worked time)</t>
</div>
<div>
<field name="frequency"/>
<t t-if="record.frequency.raw_value == 'weekly'">
on <field name="week_day"/>
</t>
<t t-elif="record.frequency.raw_value === 'monthly'">
on the <field name="first_day"/> day of the month
</t>
<t t-elif="record.frequency.raw_value === 'bimonthly'">
on the <field name="first_day"/> and on the <field name="second_day"/> days of the months
</t>
<t t-elif="record.frequency.raw_value === 'biyearly'">
on the <field name="first_month_day"/> <field name="first_month"/> and on the <field name="second_month_day"/> <field name="second_month"/>
</t>
<t t-elif="record.frequency.raw_value === 'yearly'">
on <field name="yearly_day"/> <field name="yearly_month"/>
</t>
</div>
<div t-if="record.maximum_leave.value">
Limit of <field name="maximum_leave" widget="float_without_trailing_zeros"/> <field name="added_value_type"/>
</div>
<div t-if="record.action_with_unused_accruals.raw_value">
At the end of the year, unused accruals will be <t t-if="record.action_with_unused_accruals.raw_value == 'postponed'">postponed</t><t t-else="">lost</t>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</div>
<field name="level_ids" widget="accrual_levels" invisible="not level_ids"/>
</div>
</div>
</div>
</sheet>
</sheet>
</form>
</field>
</record>
<record id="hr_accrual_plan_view_search" model="ir.ui.view">
<field name="name">hr.leave.accrual.plan.search</field>
<field name="model">hr.leave.accrual.plan</field>
<field name="arch" type="xml">
<search string="Accrual Plan">
<field name="name"/>
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
<filter string="Company" name='company_id' context="{'group_by':'company_id'}"
groups="base.group_multi_company"/>
</search>
</field>
</record>
<record id="open_view_accrual_plans" model="ir.actions.act_window">
<field name="name">Accrual Plans</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.leave.accrual.plan</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create an Accrual Plan
</p>
<p>
Use accrual plans to give determined amount of time following the rules you define
</p>
</field>
</record>
</odoo>

View file

@ -6,47 +6,77 @@
<field name="model">hr.leave.allocation</field>
<field name="arch" type="xml">
<search string="Search allocations">
<field name="employee_id"/>
<field name="name"/>
<field name="employee_id" string='Employee'/>
<field name="name" string="Title"/>
<field name="department_id"/>
<field name="holiday_status_id"/>
<field name="allocation_type"/>
<filter domain="[('state', '=', 'confirm')]" string="To Approve" name="second_approval"/>
<filter string="Approved Allocations" domain="[('state', '=', 'validate')]" name="validated"/>
<field name="accrual_plan_id"/>
<field name="activity_user_id" string="Activities of"/>
<field name="activity_type_id" string="Activity type"/>
<filter domain="[
('state','in',['confirm']),
'|',
('employee_id.user_id', '!=', uid),
'&amp;',
('employee_id.user_id', '=', uid),
('employee_id.leave_manager_id', '=', uid)]"
string="Waiting For Me"
name="waiting_for_me"
groups="hr_holidays.group_hr_holidays_responsible,!hr_holidays.group_hr_holidays_user"/>
<filter domain="[
('state','in',['confirm','validate1']),
'|',
('employee_id.user_id', '!=', uid),
'|',
'&amp;',
('state','=','confirm'),
('holiday_status_id.leave_validation_type','=','hr'),
('state','=','validate1')]"
string="Waiting For Me"
name="waiting_for_me_manager"
groups="hr_holidays.group_hr_holidays_user"/>
<separator/>
<filter name="active_types" string="Active Types" domain="[('holiday_status_id.active', '=', True)]" help="Filters only on allocations that belong to an time off type that is 'active' (active field is True)"/>
<filter domain="[('state','in',('confirm','validate1'))]" string="First Approval" name="approve"/>
<filter domain="[('state', '=', 'validate1')]" string="Second Approval" name="second_approval"/>
<filter string="Approved" domain="[('state', '=', 'validate')]" name="validated"/>
<filter string="Refused" domain="[('state', '=', 'refuse')]" name="refused_allocations"/>
<separator/>
<filter string="Unread Messages" name="message_needaction" domain="[('message_needaction','=',True)]"/>
<filter name="year" string="Currently Valid"
domain="[
('date_from', '&lt;=', 'today'),
'|',
('date_to', '=', False),
('date_to', '&gt;=', 'today'),
]"
help="Active Allocations"/>
<separator/>
<filter string="Unread Messages" name="message_needaction" domain="[('message_needaction','=',True)]" groups="mail.group_mail_notification_type_inbox"/>
<separator/>
<filter string="My Team" name="my_team" domain="['|', ('employee_id.leave_manager_id', '=', uid), ('employee_id.user_id', '=', uid)]" help="Time off of people you are manager of"/>
<filter string="My Department" name="my_team_leaves" domain="[('employee_id.parent_id.user_id', '=', uid)]" groups="hr_holidays.group_hr_holidays_manager" help="Time Off of Your Team Member"/>
<separator/>
<filter string="Active Employee" name="active_employee" domain="[('active_employee','=',True)]"/>
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
<separator/>
<filter name="year" string="Current Year"
domain="[
('date_from', '&gt;=', context_today().strftime('%Y-1-1')),
('date_from', '&lt;=', context_today().strftime('%Y-12-31')),
]"
help="Active Allocations"/>
<separator/>
<filter string="My Allocations" name="my_leaves" domain="[('employee_id.user_id', '=', uid)]"/>
<filter string="Validity Start" name="validity_start" date="date_from" start_month="0" end_month="2" start_year="-1" end_year="1"/>
<separator/>
<field name="holiday_status_id"/>
<filter invisible="1" string="My Activities" name="filter_activities_my"
domain="[('activity_user_id', '=', uid)]"/>
<separator invisible="1"/>
<filter invisible="1" string="Late Activities" name="activities_overdue"
domain="[('my_activity_date_deadline', '&lt;', context_today().strftime('%Y-%m-%d'))]"
help="Show all records which has next action date is before today"/>
domain="[('my_activity_date_deadline', '&lt;', 'today')]"
help="Show all records whose next activity date is past"/>
<filter invisible="1" string="Today Activities" name="activities_today"
domain="[('my_activity_date_deadline', '=', context_today().strftime('%Y-%m-%d'))]"/>
domain="[('my_activity_date_deadline', '=', 'today')]"/>
<filter invisible="1" string="Future Activities" name="activities_upcoming_all"
domain="[('my_activity_date_deadline', '&gt;', context_today().strftime('%Y-%m-%d'))
domain="[('my_activity_date_deadline', '&gt;', 'today')
]"/>
<separator/>
<filter name="approved_state" string="To Approve or Approved Allocations" invisible="1"
domain="[('state', 'in', ('confirm', 'validate'))]"/>
<separator/>
<group expand="0" string="Group By">
<group>
<filter name="group_employee" string="Employee" context="{'group_by':'employee_id'}"/>
<filter name="group_type" string="Time Off Type" context="{'group_by':'holiday_status_id'}"/>
<filter name="group_type" string="Type" context="{'group_by':'holiday_status_id'}"/>
<filter name="group_allocation_type" string="Allocation Type" context="{'group_by':'allocation_type'}"/>
<filter name="group_state" string="Status" context="{'group_by': 'state'}"/>
</group>
@ -63,101 +93,94 @@
<field name="model">hr.leave.allocation</field>
<field name="priority">32</field>
<field name="arch" type="xml">
<form string="Allocation Request">
<field name="can_reset" invisible="1"/>
<form string="Allocation Request" duplicate="false">
<field name="can_approve" invisible="1"/>
<field name="holiday_type" invisible="1"/>
<field name="validation_type" invisible="1"/>
<!--
The following two lines are required so that the two fields are sent as part of the `vals_list`
to the create method when the allocation is created. Otherwise, carried_over_days_expiration_date
wouldn't be set and the days won't expire on that date.
-->
<field name="expiring_carryover_days" invisible="1"/>
<field name="carried_over_days_expiration_date" invisible="1"/>
<header>
<button string="Confirm" name="action_confirm" states="draft" type="object" class="oe_highlight"/>
<field name="state" widget="statusbar" statusbar_visible="draft,confirm,validate"/>
<button string="Approve" name="action_approve" type="object" class="oe_highlight" invisible="not can_approve or not id"/>
<button string="Validate" name="action_approve" invisible="not can_validate or can_approve or not id" type="object" class="oe_highlight"/>
<button string="Refuse" name="action_refuse" type="object" invisible="not can_refuse or not id"/>
<field name="state" widget="statusbar" statusbar_visible="confirm,validate,validate1" invisible="validation_type != 'both'"/>
<field name="state" widget="statusbar" statusbar_visible="confirm,validate" invisible="validation_type == 'both'"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button
class="oe_stat_button"
icon="fa-calendar"
type="action"
invisible="1"
name="%(hr_leave_action_holiday_allocation_id)d"
help="Time off Taken/Total Allocated">
<div class="o_stat_info">
<span class="o_stat_value">
<field name="leaves_taken" digits="[42,1]"/>/<field name="max_leaves" digits="[42,1]"/>
</span>
<span class="o_stat_text">
Time Off
</span>
</div>
</button>
</div>
<div class="oe_button_box" name="button_box"/>
<div id="title" class="oe_title">
<h2><field name="name" class="w-100" placeholder="e.g. Time Off type (From validity start to validity end / no limit)" attrs="{'invisible': [('state', 'not in', ('draft', 'confirm'))]}" required="1"/>
<field name="name_validity" attrs="{'invisible': [('state', 'in', ('draft', 'confirm'))]}"/></h2>
<h2><field name="name" class="w-100"
placeholder="e.g. Time Off type (From validity start to validity end / no limit)"
invisible="state != 'confirm'" readonly="True" force_save="True"/>
<field name="name_validity" invisible="state == 'confirm'"/></h2>
</div>
<group>
<group>
<group id="full_group">
<group id="alloc_left_col">
<field name="is_name_custom" invisible="1"/> <!-- needed for triggering reasons -->
<field name="type_request_unit" invisible="1"/>
<field name="holiday_status_id" context="{'employee_id':employee_id, 'default_date_from':current_date, 'request_type':'allocation'}" options="{'always_reload': True}"/>
<field name="allocation_type" invisible="1" widget="radio"
attrs="{'readonly': ['|', ('is_officer', '=', False), ('state', 'not in', ('draft', 'confirm'))]}"/>
<!-- Save already_accrued when creating record to avoid double allocation when cron runs -->
<field name="already_accrued" invisible="1"/>
<field name="holiday_status_id"
context="{'employee_id':employee_id, 'default_date_from':current_date, 'request_type':'allocation'}"
readonly="state == 'validate'"/>
<field name="allocation_type"
widget="radio"
invisible="1"
readonly="not is_officer or state == 'validate'"/>
<field name="is_officer" invisible="1"/>
<field name="accrual_plan_id" attrs="{'invisible': [('allocation_type', '=', 'regular')], 'readonly': ['|', ('is_officer', '=', False), ('state', 'not in', ('draft', 'confirm'))]}"/>
<div class="o_td_label" name="validity_label">
<label for="date_from" string="Validity Period" attrs="{'invisible': ['|', ('allocation_type', '=', 'accrual'), ('state', 'not in', ('draft', 'confirm'))]}"/>
<label for="date_from" string="Start Date" attrs="{'invisible': [('allocation_type', '=', 'regular')]}"/>
<field name="accrual_plan_id"
invisible="allocation_type == 'regular'"
required="allocation_type == 'accrual'"
readonly="not is_officer or state == 'validate'"/>
<div class="o_td_label" name="validity_label" invisible="not is_officer">
<label for="date_from" string="Validity Period"
invisible="allocation_type == 'accrual' or state != 'confirm'"/>
<label for="date_from" string="Start Date" invisible="allocation_type == 'regular'"/>
</div>
<div class="o_row" name="validity">
<field name="date_from" widget="date" nolabel="1" readonly="1" attrs="{'invisible': ['&amp;', ('allocation_type', '=', 'regular'), ('state', 'not in', ('draft', 'confirm'))]}"/>
<i class="fa fa-long-arrow-right mx-2" aria-label="Arrow icon" title="Arrow" attrs="{'invisible': ['|', ('allocation_type', '=', 'accrual'), ('state', 'not in', ('draft', 'confirm'))]}"/>
<label class="mx-2" for="date_to" string="Run until" attrs="{'invisible': [('allocation_type', '=', 'regular')]}"/>
<field name="date_to" widget="date" nolabel="1" readonly="1" placeholder="No Limit" attrs="{'invisible': ['&amp;', ('allocation_type', '=', 'regular'), ('state', 'not in', ('draft', 'confirm'))]}"/>
<div id="no_limit_label" class="oe_read_only" attrs="{'invisible': ['|', '|', ('id', '=', False), ('date_to', '!=', False), ('state', 'not in', ('draft', 'confirm'))]}">No limit</div>
<div class="o_row" name="validity" invisible="not is_officer">
<field name="date_from" nolabel="1" readonly="allocation_type == 'accrual' and state != 'confirm'"
invisible="allocation_type == 'regular' and state != 'confirm'"/>
<i class="fa fa-long-arrow-right mx-2" aria-label="Arrow icon" title="Arrow"
invisible="allocation_type == 'accrual' or state != 'confirm'"/>
<label class="mx-2" for="date_to" string="Run until"
invisible="allocation_type == 'regular'"/>
<field name="date_to" nolabel="1"
placeholder="No Limit" readonly="allocation_type == 'accrual' and state != 'confirm'"
invisible="allocation_type == 'regular' and state != 'confirm'"/>
<div id="no_limit_label" class="oe_read_only"
invisible="not id or date_to or state != 'confirm'">No limit</div>
</div>
<div colspan="2" class="oe_row alert alert-warning my-2" role="alert"
invisible="id or not date_to or not (date_to &lt; context_today().strftime('%Y-%m-%d')) or (date_from and (date_to &lt; date_from))">
<span>The allocated days cannot be used, because the allocation is set to finish in the past.</span>
</div>
<field name="number_of_days" invisible="1"/>
<div class="o_td_label">
<label for="number_of_days_display" string="Duration"
attrs="{'readonly': [('allocation_type', '=', 'accrual'), ('state', 'not in', ('draft', 'confirm'))]}"/>
<label for="number_of_days_display" string="Allocation"
readonly="allocation_type == 'accrual' or state == 'validate'"/>
</div>
<div name="duration_display">
<field name="number_of_days_display" nolabel="1" style="width: 5rem;"
attrs="{'readonly': [
'|',
'|',
'&amp;',
('is_officer', '!=', True),
('state', 'not in', ('draft', 'confirm')),
('type_request_unit', '=', 'hour'),
('allocation_type', '=', 'accrual')
],
'invisible': [('type_request_unit', '=', 'hour')]}"/>
<field name="number_of_hours_display" nolabel="1" style="width: 5rem;"
attrs="{'readonly': [
'|',
'|',
'&amp;',
('is_officer', '!=', True),
('state', 'not in', ('draft', 'confirm')),
('type_request_unit', '!=', 'hour'),
('allocation_type', '=', 'accrual')
],
'invisible': [('type_request_unit', '!=', 'hour')]}"/>
<span class="ml8" attrs="{'invisible': [('type_request_unit', '=', 'hour')]}">Days</span>
<span class="ml8" attrs="{'invisible': [('type_request_unit', '!=', 'hour')]}">Hours</span>
<field name="number_of_days_display" nolabel="1" style="width: 6ch;"
invisible="type_request_unit == 'hour'"
readonly="state != 'confirm' and not is_officer"/>
<field name="number_of_hours_display" nolabel="1" style="width: 6ch;"
invisible="type_request_unit != 'hour'"
readonly="state != 'confirm' and not is_officer"/>
<span class="ml8" invisible="type_request_unit == 'hour'">Days</span>
<span class="ml8" invisible="type_request_unit != 'hour'">Hours</span>
</div>
</group>
<group name="alloc_right_col">
<field name="employee_id" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="employee_id" invisible="1" readonly="state in ['refuse', 'validate']"/>
</group>
</group>
<field name="notes" nolabel="1" placeholder="Add a reason..."/>
<field name="notes" nolabel="1" placeholder="Add a reason..." readonly="state not in ['confirm']"/>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids"/>
<field name="activity_ids"/>
<field name="message_ids"/>
</div>
<chatter/>
</form>
</field>
</record>
@ -169,65 +192,34 @@
<field name="mode">primary</field>
<field name="priority">16</field>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_confirm']" position="after">
<button string="Validate" name="action_validate" states="confirm" type="object" class="oe_highlight"/>
<button string="Refuse" name="action_refuse" type="object"
attrs="{'invisible': ['|', ('can_approve', '=', False), ('state', 'not in', ('confirm','validate'))]}"/>
<button string="Mark as Draft" name="action_draft" type="object"
attrs="{'invisible': ['|', ('can_reset', '=', False), ('state', 'not in', ['confirm', 'refuse'])]}"/>
</xpath>
<xpath expr="//div[@id='title']" position="replace">
<div id="title" position="replace">
<div class="oe_title">
<h2><field name="name" placeholder="e.g. Time Off type (From validity start to validity end / no limit)" required="1"/></h2>
</div>
</xpath>
<xpath expr="//field[@name='employee_id']" position="before">
<field name="holiday_type" string="Mode" groups="hr_holidays.group_hr_holidays_user" context="{'employee_id':employee_id}" />
</xpath>
<xpath expr="//field[@name='employee_id']" position="replace">
<!-- :TestLeaveRequests.test_allocation_request -->
<field name="employee_id" invisible="1"/>
<field name="multi_employee" invisible="1" force_save="1"/>
<!-- Employee id is only visible if the allocation is created specifically for that user in `_action_validate_create_childs` -->
<field name="employee_id" groups="hr_holidays.group_hr_holidays_user"
attrs="{'invisible': ['|', '|', ('holiday_type', '!=', 'employee'), ('employee_id', '=', False), ('state', 'in', ('draft', 'cancel', 'confirm'))]}"
options="{'relation': 'hr.employee.public'}" widget="many2one_avatar_employee"/>
<field name="employee_ids" widget="many2many_avatar_employee"
groups="hr_holidays.group_hr_holidays_user"
attrs="{'required': [('holiday_type', '=', 'employee'), ('state', 'in', ('draft', 'cancel', 'confirm'))],
'invisible': ['|', ('holiday_type', '!=', 'employee'), '&amp;', ('state', 'not in', ('draft', 'cancel', 'confirm')), ('employee_id', '!=', False)]}"
options="{'relation': 'hr.employee.public'}"/>
</xpath>
<xpath expr="//field[@name='employee_id']" position="after">
<field name="category_id"
attrs="{'required': [('holiday_type', '=', 'category')], 'invisible': [('holiday_type', '!=', 'category')]}"/>
</xpath>
<xpath expr="//field[@name='department_id']" position="replace">
<field name="department_id" groups="hr_holidays.group_hr_holidays_user"
attrs="{'required': [('holiday_type', '=', 'department')], 'invisible': [('holiday_type', '!=', 'department')]}"/>
</xpath>
<xpath expr="//field[@name='department_id']" position="after">
<field name="mode_company_id" string="Company" groups="hr_holidays.group_hr_holidays_user"
attrs="{'required': [('holiday_type', '=', 'company')], 'invisible': [('holiday_type', '!=', 'company')]}"/>
</xpath>
<xpath expr="//field[@name='allocation_type']" position="attributes">
</div>
<field name="employee_id" position="replace">
<field name="employee_id"
readonly="state in ['refuse', 'validate']"
widget="many2one_avatar_employee"/>
</field>
<field name="allocation_type" position="attributes">
<attribute name="invisible">0</attribute>
</xpath>
<xpath expr="//label[@for='date_from']" position="replace">
<label for="date_from" string="Validity Period" attrs="{'invisible': [('allocation_type', '=', 'accrual')]}"/>
</xpath>
<xpath expr="//field[@name='date_from']" position="replace">
<field name="date_from" widget="date" nolabel="1" readonly="0" attrs="{'readonly': [('allocation_type', '=', 'accrual'), ('state', 'not in', ('draft', 'confirm'))]}"/>
</xpath>
</field>
<label for="date_from" position="replace">
<label for="date_from" string="Validity Period" invisible="allocation_type == 'accrual'"/>
</label>
<field name="date_from" position="attributes">
<attribute name="invisible">0</attribute>
</field>
<xpath expr="//i[hasclass('fa-long-arrow-right')]" position="replace">
<i class="fa fa-long-arrow-right mx-2" aria-label="Arrow icon" title="Arrow" attrs="{'invisible': [('allocation_type', '=', 'accrual')]}"/>
</xpath>
<xpath expr="//field[@name='date_to']" position="replace">
<field name="date_to" widget="date" nolabel="1" readonly="0" placeholder="No Limit" attrs="{'readonly': [('allocation_type', '=', 'accrual'), ('state', 'not in', ('draft', 'confirm'))]}"/>
</xpath>
<xpath expr="//div[@id='no_limit_label']" position="replace">
<div id="no_limit_label" class="oe_read_only" attrs="{'invisible': ['|', ('id', '=', False), ('date_to', '!=', False)]}">No limit</div>
<i class="fa fa-long-arrow-right mx-2" aria-label="Arrow icon" title="Arrow" invisible="allocation_type == 'accrual'"/>
</xpath>
<field name="date_to" position="attributes">
<attribute name="invisible">0</attribute>
</field>
<div id="no_limit_label" position="replace">
<div id="no_limit_label" class="oe_read_only" invisible="not id or date_to">No limit</div>
</div>
</field>
</record>
@ -241,23 +233,31 @@
<xpath expr="//header" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//group[@id='full_group']" position="before">
<xpath expr="//group[@id='alloc_left_col']" position="move"/>
</xpath>
<xpath expr="//group[@id='full_group']" position="replace"/>
<div name="button_box" position="attributes">
<attribute name="invisible">1</attribute>
</div>
<div name="validity_label" position="attributes">
<attribute name="invisible">1</attribute>
</div>
<label for="number_of_days_display" position="attributes">
<attribute name="string">Ask for</attribute>
</label>
<div name="validity" position="attributes">
<attribute name="invisible">1</attribute>
</div>
<div id="title" position="replace"/>
<label for="date_from" position="attributes">
<attribute name="invisible">1</attribute>
</label>
<div class="oe_chatter" position="replace"/>
<chatter position="replace"/>
</field>
</record>
<record id="hr_leave_allocation_view_form_manager_dashboard" model="ir.ui.view">
<record id="hr_leave_allocation_view_form_manager_dashboard" model="ir.ui.view">
<field name="name">hr.leave.allocation.view.form.manager.dashboard</field>
<field name="model">hr.leave.allocation</field>
<field name="inherit_id" ref="hr_holidays.hr_leave_allocation_view_form_manager"/>
@ -270,56 +270,78 @@
<div name="button_box" position="attributes">
<attribute name="invisible">1</attribute>
</div>
<label for="number_of_days_display" position="attributes">
<attribute name="string">Ask for</attribute>
</label>
</field>
</record>
<record id="hr_leave_allocation_view_tree" model="ir.ui.view">
<field name="name">hr.leave.allocation.view.tree</field>
<field name="name">hr.leave.allocation.view.list</field>
<field name="model">hr.leave.allocation</field>
<field name="priority">16</field>
<field name="arch" type="xml">
<tree string="Allocation Requests" sample="1" decoration-info="state == 'draft'">
<field name="employee_id" decoration-muted="not active_employee"/>
<field name="department_id" optional="hide"/>
<field name="holiday_status_id" class="fw-bold"/>
<field name="name"/>
<field name="duration_display" string="Duration"/>
<list string="Allocation Requests" sample="1" class="o_hr_holidays_list" js_class="hr_holidays_payslip_list">
<header>
<button type="action"
name="%(hr_holidays.action_hr_leave_allocation_generate_multi_wizard)d"
string="New Group Allocation" class="btn btn-secondary"
groups="hr_holidays.group_hr_holidays_responsible" display="always"
/>
<button type="object"
name="action_approve"
string="Approve"
icon="fa-thumbs-up"
class="btn btn-outline-success"
/>
<button type="object"
name="action_refuse"
string="Refuse"
icon="fa-times"
class="btn btn-outline-danger"
/>
</header>
<field name="employee_id" decoration-muted="not active_employee" widget="many2one_avatar_employee" readonly="state in ['refuse', 'validate']"/>
<field name="department_id" optional="hide" readonly="state not in ['confirm']"/>
<field name="holiday_status_id" class="fw-bold" readonly="state in ['refuse', 'validate', 'validate1']"/>
<field name="name" string="Title" optional="hide"/>
<field name="duration_display" string="Amount"/>
<field name="date_from" string="Validity Start" optional="hide"/>
<field name="date_to" string="Validity Stop" optional="hide"/>
<field name="allocation_type"/>
<field name="message_needaction" invisible="1"/>
<field name="active_employee" invisible="1"/>
<field name="state" widget="badge" decoration-info="state == 'draft'" decoration-warning="state == 'confirm'" decoration-success="state == 'validate'"/>
<button string="Validate" name="action_validate" type="object"
<field name="date_to" string="Validity Stop" optional="hide" readonly="state in ['refuse', 'validate', 'validate1']"/>
<field name="allocation_type" readonly="state not in ['confirm']"/>
<field name="accrual_plan_id"/>
<field name="notes" string="Reason" optional="hide"/>
<field name="message_needaction" column_invisible="True"/>
<field name="active_employee" column_invisible="True"/>
<field name="state" widget="badge" decoration-warning="state in ['confirm', 'validate1']" decoration-success="state == 'validate'" decoration-danger="state == 'refuse'"/>
<button string="Approve" name="action_approve" type="object" class="text-success"
icon="fa-thumbs-up"
invisible="not can_approve"/>
<button string="Validate" name="action_approve" type="object" class="text-success"
icon="fa-check"
states="confirm"
groups="hr_holidays.group_hr_holidays_user"/>
<button string="Refuse" name="action_refuse" type="object"
invisible="not can_validate or can_approve"/>
<button string="Refuse" name="action_refuse" type="object" class="text-danger"
icon="fa-times"
states="confirm"
groups="hr_holidays.group_hr_holidays_user"/>
invisible="not can_refuse"/>
<field name="activity_exception_decoration" widget="activity_exception"/>
</tree>
</list>
</field>
</record>
<record id="hr_leave_allocation_view_tree_my" model="ir.ui.view">
<field name="name">hr.leave.allocation.view.tree.my</field>
<field name="name">hr.leave.allocation.view.list.my</field>
<field name="model">hr.leave.allocation</field>
<field name="inherit_id" ref="hr_leave_allocation_view_tree"/>
<field name="mode">primary</field>
<field name="priority">32</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='employee_id']" position="attributes">
<attribute name="invisible">1</attribute>
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='department_id']" position="attributes">
<attribute name="invisible">1</attribute>
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//button[@name='action_validate']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//button[@name='action_refuse']" position="attributes">
<xpath expr="//button[@name='%(hr_holidays.action_hr_leave_allocation_generate_multi_wizard)d']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
@ -345,6 +367,9 @@
<xpath expr="//filter[@name='my_leaves']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//filter[@name='group_employee']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
@ -368,62 +393,127 @@
<field name="name">hr.leave.allocation.view.kanban</field>
<field name="model">hr.leave.allocation</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile" create="0" sample="1">
<field name="employee_id"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="name"/>
<field name="number_of_days"/>
<kanban class="o_holidays_view_kanban" sample="1">
<header>
<button type="action"
name="%(hr_holidays.action_hr_leave_allocation_generate_multi_wizard)d"
string="New Group Allocation" class="btn btn-secondary"
groups="hr_holidays.group_hr_holidays_responsible" display="always"/>
</header>
<field name="can_approve"/>
<field name="can_validate"/>
<field name="can_refuse"/>
<field name="state"/>
<field name="holiday_status_id"/>
<field name="employee_id"/>
<field name="write_date"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click container">
<div class="row g-0">
<div class="col-3">
<img t-att-src="kanban_image('hr.employee.public', 'avatar_128', record.employee_id.raw_value)"
t-att-title="record.employee_id.value"
t-att-alt="record.employee_id.value"
class="o_image_64_cover float-start mr4"/>
</div>
<div class="col-9">
<span class="badge rounded-pill float-end mt4 mr16"><t t-esc="record.number_of_days.value"/> days</span>
<strong class="o_kanban_record_title"><t t-esc="record.employee_id.value"/></strong>
<div class="text-muted o_kanban_record_subtitle">
<t t-esc="record.holiday_status_id.value"/>
</div>
<div class="o_dropdown_kanban dropdown" groups="base.group_user">
<a role="button" class="dropdown-toggle o-no-caret btn" data-bs-toggle="dropdown" href="#" aria-label="Dropdown menu" title="Dropdown menu">
<span class="fa fa-ellipsis-v"/>
</a>
<div class="dropdown-menu" role="menu">
<a t-if="widget.editable" role="menuitem" type="edit" class="dropdown-item">Edit Allocation</a>
<a t-if="widget.deletable" role="menuitem" type="delete" class="dropdown-item">Delete</a>
<t t-name="card" class="flex-row">
<div class="o_hr_holidays_kanban w-100">
<widget name="web_ribbon" title="To Approve" bg_color="text-bg-warning" invisible="state != 'confirm'"/>
<widget name="web_ribbon" title="To Validate" bg_color="text-bg-warning" invisible="state != 'validate1'"/>
<widget name="web_ribbon" title="Cancelled" bg_color="text-bg-danger" invisible="state != 'cancel'"/>
<widget name="web_ribbon" title="Refused" bg_color="bg-danger" invisible="state != 'refuse'"/>
<widget name="web_ribbon" title="Approved" bg_color="bg-success" invisible="state != 'validate'"/>
<aside>
<img t-att-src="'/web/image/hr.employee.public/' + record.employee_id.raw_value + '/avatar_128?unique=' + record.write_date.raw_value"
class="o_image_64_cover float-start mb-2 me-2" alt="Employee's image"/>
</aside>
<main class="h-100">
<div class="justify-content-center o_holidays_kanban_card">
<div class="d-flex flex-row">
<div class="col-12 align-items-center o_hr_holidays_value">
<div class="col-4 o_hr_holidays_card">
<field class="fw-bold fs-3 mb-2" name="employee_id"/>
</div>
<div class="col-2 o_hr_holidays_name">
<div class="o_hr_holidays_card">
<field name="holiday_status_id" class="fw-bold me-1"/>
<div class="d-flex flex-wrap">
( <field name="allocation_type"/> )
</div>
</div>
</div>
<div class="col-2 o_hr_holidays_card">
<div class="fw-bold d-flex me-1">
<field name="duration_display"/>
</div>
Amount
</div>
<div class="col-2 o_hr_holidays_card">
<div class="fw-bold d-flex gap-1 me-1">
<field name="virtual_remaining_leaves" widget="float" digits="[3,2]"/>
/
<field name="max_leaves" widget="float" digits="[3,2]"/>
</div>
<span>
Current balance
</span>
</div>
<div class="col-2 o_hr_holidays_button flex-wrap d-flex pe-4 gap-2 justify-content-start">
<button
name="action_approve" type="object" class="btn btn-primary"
t-if="record.can_approve.raw_value">
Approve
</button>
<button
name="action_approve" type="object" class="btn btn-primary"
t-if="record.can_validate.raw_value and !record.can_approve.raw_value">
Validate
</button>
<button
name="action_refuse" type="object" class="btn btn-secondary"
t-if="record.can_refuse.raw_value">
Refuse
</button>
</div>
</div>
</div>
<div t-if="['validate', 'refuse'].includes(record.state.raw_value)">
<span t-if="record.state.raw_value === 'validate'" class="fa fa-check text-muted" aria-label="validated"/>
<span t-else="" class="fa fa-ban text-muted" aria-label="refused"/>
<t t-set="classname" t-value="{'validate': 'text-bg-success', 'refuse': 'text-bg-danger'}[record.state.raw_value] || 'text-bg-light'"/>
<span t-attf-class="badge rounded-pill {{ classname }}"><t t-esc="record.state.value"/></span>
</div>
<div t-if="record.can_approve.raw_value">
<button t-if="record.state.raw_value === 'confirm'" name="action_validate" type="object" class="btn btn-link btn-sm ps-0">
<i class="fa fa-check"/> Validate
</button>
<button t-if="record.state.raw_value === 'confirm'" name="action_refuse" type="object" class="btn btn-link btn-sm ps-0">
<i class="fa fa-times"/> Refuse
</button>
</div>
</main>
</div>
<div class="o_hr_holidays_kanban_mobile w-100">
<main class="ps-1 d-flex flex-column w-100 gap-1">
<div class="w-100 d-flex flex-row gap-2 align-items-center">
<field class="fw-bold" name="employee_id" widget="many2one_avatar_employee"/>
<field class="fw-bold w-100" name="employee_id"/>
<span
style="min-width: fit-content;"
t-attf-class="rounded-pill badge flex-shrink-1 text-bg-{{
record.state.raw_value == 'validate' ? 'success' :
['confirm', 'validate1'].includes(record.state.raw_value) ?
'warning' : 'danger' }}"
t-out="record.state.value"/>
</div>
<div class="content d-flex flex-row gap-1 mb-2">
<field name="holiday_status_id" class="text-muted"/>
<div class="text-muted">
(<field name="duration_display"/>)
</div>
</div>
</div>
</main>
<bottom class="d-flex justify-content-end gap-2">
<button
name="action_approve" type="object" class="btn btn-sm btn-primary py-0"
t-if="record.can_approve.raw_value">
Approve
</button>
<button
name="action_approve" type="object" class="btn btn-sm btn-primary py-0"
t-if="record.can_validate.raw_value and !record.can_approve.raw_value">
Validate
</button>
<button
name="action_refuse" type="object" class="btn btn-sm btn-secondary py-0"
t-if="record.can_refuse.raw_value">
Refuse
</button>
</bottom>
</div>
</t>
</templates>
</kanban>
</field>
</record>
</record>
<record id="hr_leave_allocation_view_activity" model="ir.ui.view">
<field name="name">hr.leave.allocation.view.activity</field>
@ -433,12 +523,9 @@
<field name="employee_id"/>
<templates>
<div t-name="activity-box">
<img t-att-src="activity_image('hr.employee', 'avatar_128', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
<div>
<field name="employee_id"/>
<span class="ms-3 text-muted">
<field name="number_of_days"/> days
</span>
<img class="rounded" t-att-src="activity_image('hr.employee', 'avatar_128', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
<div class="ms-2">
<field name="employee_id" class="o_text_block o_text_bold"/> <span class="text-muted">(<field name="number_of_days"/> days)</span>
<field name="holiday_status_id" muted="1" display="full"/>
</div>
</div>
@ -450,22 +537,21 @@
<record id="hr_leave_allocation_action_my" model="ir.actions.act_window">
<field name="name">My Allocations</field>
<field name="res_model">hr.leave.allocation</field>
<field name="view_mode">tree,kanban,form,activity</field>
<field name="view_mode">list,kanban,form,activity</field>
<field name="search_view_id" ref="hr_holidays.hr_leave_allocation_view_search_my"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new time off allocation request
Create a new allocation request
</p><p>
Time Off Officers allocate time off days to employees (e.g. paid time off).<br/>
Employees request allocations to Time Off Officers (e.g. recuperation days).
You can create a new allocation or follow the approval status of the current ones.
</p>
</field>
<field name="context">{}</field>
<field name="context">{'search_default_year': 1 , 'is_employee_allocation': True}</field>
<field name="domain">[('employee_id.user_id', '=', uid)]</field>
</record>
<record id="hr_leave_allocation_action_my_view_tree" model="ir.actions.act_window.view">
<field name="sequence">1</field>
<field name="view_mode">tree</field>
<field name="view_mode">list</field>
<field name="act_window_id" ref="hr_leave_allocation_action_my"/>
<field name="view_id" ref="hr_leave_allocation_view_tree_my"/>
</record>
@ -479,46 +565,41 @@
<record id="hr_leave_allocation_action_all" model="ir.actions.act_window">
<field name="name">All Allocations</field>
<field name="res_model">hr.leave.allocation</field>
<field name="view_mode">tree,kanban,form,activity</field>
<field name="view_mode">list,kanban,form,activity</field>
<field name="context">{}</field>
<field name="domain">[]</field>
<field name="search_view_id" ref="hr_holidays.hr_leave_allocation_view_search_manager"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new time off allocation request
Create a new allocation request
</p><p>
Time Off Officers allocate time off days to employees (e.g. paid time off).<br/>
Employees request allocations to Time Off Officers (e.g. recuperation days).
You can create a new allocation or follow the approval status of the current ones.
</p>
</field>
</record>
<record id="hr_leave_allocation_action_form" model="ir.actions.act_window">
<field name="name">New allocation</field>
<field name="res_model">hr.leave.allocation</field>
<field name="view_mode">form</field>
<field name="context">{}</field>
<field name="domain">[]</field>
<field name="search_view_id" ref="hr_holidays.hr_leave_allocation_view_search_manager"/>
</record>
<record id="hr_leave_allocation_action_approve_department" model="ir.actions.act_window">
<field name="name">Allocations</field>
<field name="res_model">hr.leave.allocation</field>
<field name="view_mode">tree,form,kanban,activity</field>
<field name="context">{'search_default_my_team': 1,'search_default_approve': 2, 'search_default_active_employee': 3}</field>
<field name="view_mode">kanban,list,form,activity</field>
<field name="context">{'search_default_my_team': 1,'search_default_approve': 2}</field>
<field name="domain">[]</field>
<field name="search_view_id" ref="hr_holidays.hr_leave_allocation_view_search_manager"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new time off allocation
Create a new allocation request
</p><p>
Time Off Officers allocate time off days to employees (e.g. paid time off).<br/>
Employees request allocations to Time Off Officers (e.g. recuperation days).
You can create a new allocation or follow the approval status of the current ones.
</p>
</field>
</record>
<record id="ir_actions_server_approve_allocations" model="ir.actions.server">
<field name="name">Approve Allocations</field>
<field name="model_id" ref="hr_holidays.model_hr_leave_allocation"/>
<field name="binding_model_id" ref="hr_holidays.model_hr_leave_allocation"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">
if records:
records.action_validate()
</field>
</record>
</odoo>

View file

@ -0,0 +1,82 @@
<?xml version='1.0' encoding='UTF-8' ?>
<odoo>
<record id="hr_leave_mandatory_day_view_form" model="ir.ui.view">
<field name="model">hr.leave.mandatory.day</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<group>
<field name="name"/>
<field name="start_date" string="Dates" widget="daterange" options="{'end_date_field': 'end_date'}" />
<field name="end_date" invisible="1" />
</group>
<group>
<field name="color" widget="color_picker"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="hr_leave_mandatory_day_view_list" model="ir.ui.view">
<field name="model">hr.leave.mandatory.day</field>
<field name="arch" type="xml">
<list editable="bottom">
<field name="company_id" column_invisible="True"/>
<field name="name"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="department_ids" widget="many2many_tags" optional="hide"/>
<field name="job_ids" widget="many2many_tags" optional="hide"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="color" widget="color_picker"/>
</list>
</field>
</record>
<record id="hr_leave_mandatory_day_view_search" model="ir.ui.view">
<field name="model">hr.leave.mandatory.day</field>
<field name="arch" type="xml">
<search string="Mandatory Day">
<field name="name"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="company_id" groups="base.group_multi_company"/>
<separator />
<filter name="filter_date" date="start_date" default_period="year" string="Period"/>
<group>
<filter name="department" string="Department" context="{'group_by': 'department_ids'}"/>
<filter name="job" string="Job" context="{'group_by': 'job_ids'}"/>
<filter name="company" string="Company" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
</group>
</search>
</field>
</record>
<record id="hr_leave_mandatory_day_action" model="ir.actions.act_window">
<field name="name">Mandatory Days</field>
<field name="res_model">hr.leave.mandatory.day</field>
<field name="view_mode">list,form</field>
<field name="search_view_id" ref="hr_leave_mandatory_day_view_search"/>
<field name="context">{'search_default_filter_date': True}</field>
<field name="help" type="html">
<p class="o_view_nocontent_empty_folder">
No mandatory days yet!
</p>
<p class="d-flex flex-column">
<span>
Set mandatory days to prevent employees
</span>
<span>
from taking days off during critical periods.
</span>
</p>
<p>
e.g. Company Event
</p>
</field>
</record>
</odoo>

View file

@ -1,65 +0,0 @@
<?xml version='1.0' encoding='UTF-8' ?>
<odoo>
<record id="hr_leave_stress_day_view_form" model="ir.ui.view">
<field name="model">hr.leave.stress.day</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<group>
<field name="name"/>
<label for="start_date" string="Dates"/>
<div class="o_row">
<field name="start_date" nolabel="1" class="oe_inline" widget="daterange" options="{'related_end_date': 'end_date'}"/>
<i class="fa fa-long-arrow-right mx-2" aria-label="Arrow icon" title="To"/>
<field name="end_date" nolabel="1" class="oe_inline" widget="daterange" options="{'related_start_date': 'start_date'}"/>
</div>
</group>
<group>
<field name="color" widget="color_picker"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="hr_leave_stress_day_view_list" model="ir.ui.view">
<field name="model">hr.leave.stress.day</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="company_id" invisible="1"/>
<field name="name"/>
<field name="company_id" groups="base.group_multi_company" optional="hide"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="color" widget="color_picker" width="1"/>
<field name="department_ids" widget="many2many_tags"/>
<field name="resource_calendar_id" optional="hide"/>
</tree>
</field>
</record>
<record id="hr_leave_stress_day_view_search" model="ir.ui.view">
<field name="model">hr.leave.stress.day</field>
<field name="arch" type="xml">
<search string="Stress Days">
<field name="name"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="company_id" groups="base.group_multi_company"/>
<separator />
<filter name="filter_date" date="start_date" default_period="this_year" string="Period"/>
</search>
</field>
</record>
<record id="hr_leave_stress_day_action" model="ir.actions.act_window">
<field name="name">Stress Days</field>
<field name="res_model">hr.leave.stress.day</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="hr_leave_stress_day_view_search"/>
<field name="context">{'search_default_filter_date': True}</field>
</record>
</odoo>

View file

@ -10,6 +10,7 @@
<field name="create_calendar_meeting"/>
<separator/>
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
<filter string="Country" name="country" context="{'group_by': 'country_id'}"/>
</search>
</field>
</record>
@ -25,10 +26,10 @@
type="object"
name="action_see_days_allocated"
icon="fa-calendar"
attrs="{'invisible': ['|', ('requires_allocation', '=', 'no'), ('id', '=', False)]}"
invisible="not requires_allocation or not id"
help="Count of allocations for this time off type (approved or waiting for approbation) with a validity period starting this year.">
<div class="o_stat_info">
<field name="allocation_count"/>
<field name="allocation_count" class="o_stat_value"/>
<span class="o_stat_text">Allocations</span>
</div>
</button>
@ -36,10 +37,10 @@
type="object"
name="action_see_group_leaves"
icon="fa-calendar"
attrs="{'invisible': [('id', '=', False)]}"
invisible="not id"
help="Count of time off requests for this time off type (approved or waiting for approbation) with a start date in the current year.">
<div class="o_stat_info">
<field name="group_days_leave"/>
<field name="group_days_leave" class="o_stat_value"/>
<span class="o_stat_text">Time Off</span>
</div>
</button>
@ -47,45 +48,84 @@
type="object"
name="action_see_accrual_plans"
icon="fa-calendar"
attrs="{'invisible': ['|', ('id', '=', False), ('accrual_count', '=', 0)]}"
invisible="not id or accrual_count == 0"
help="Count of plans linked to this time off type.">
<div class="o_stat_info">
<field name="accrual_count"/>
<field name="accrual_count" class="o_stat_value"/>
<span class="o_stat_text">Accruals</span>
</div>
</button>
</div>
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
<widget name="web_ribbon" title="Archived" bg_color="text-bg-danger" invisible="active"/>
<label for="name">Time off type</label>
<div class="oe_title">
<h1><field name="name"/></h1>
<field name="name" placeholder="e.g. Yearly Vacation" class="h1"/>
</div>
<group>
<group>
<field name="request_unit" widget="radio" options="{'horizontal': True}"/>
<field name="time_type" required="1" string="Count as"/>
<field name="responsible_ids"
widget="many2many_tags"
placeholder="Nobody to notify"
invisible="leave_validation_type in ['no_validation', 'manager'] and (not requires_allocation or allocation_validation_type not in ['hr', 'both'])"/>
</group>
<group>
<field name="company_id" groups="base.group_multi_company" readonly="is_used" placeholder="Visible to all"/>
<field name="country_id" groups="base.group_multi_company" readonly="company_id or is_used"/>
<field name="country_id" invisible="1"/>
</group>
</group>
<group>
<group name="leave_validation" id="time_off_requests" string="Time Off Requests">
<field name="active" invisible="1"/>
<field name="leave_validation_type" string="Approval" widget="radio"/>
<field name="responsible_id"
attrs="{
'invisible': [('leave_validation_type', 'in', ['no_validation', 'manager']), '|', ('requires_allocation', '=', 'no'), ('allocation_validation_type', '!=', 'officer')],
'required': ['|',('leave_validation_type', 'in', ['both', 'hr']), ('requires_allocation', '=', 'yes'), ('allocation_validation_type', '=', 'officer')]}"/>
<field name="request_unit"/>
<field name="support_document" string="Allow To Attach Supporting Document" />
<field name="time_type" required="1"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<group name="allocation_validation" id="allocation_requests" string="Allocation Requests">
<field name="requires_allocation" widget="radio" options="{'horizontal':true}"/>
<field name="employee_requests" widget="radio" attrs="{'invisible': [('requires_allocation', '=', 'no')]}"/>
<field name="allocation_validation_type" string="Approval" widget="radio" attrs="{'invisible': ['|', ('requires_allocation', '=', 'no'), ('employee_requests', '=', 'no')]}"/>
<field name="requires_allocation" widget="checkbox"/>
<field name="employee_requests" widget="checkbox" invisible="not requires_allocation"/>
<field name="allocation_validation_type" string="Approval" widget="radio" invisible="not requires_allocation"/>
</group>
</group>
<group name="visual" id="visual" >
<group colspan="2" string="Display Option">
<group style="justify-content: unset;">
<group name="configuration" id="configuration" string="Configuration">
<div class="o_cell o_wrap_label text-break text-900 d-flex flex-row" colspan="2">
<div class="d-flex flex-column gap-2">
<label for="include_public_holidays_in_duration" class="me-4"/>
<label for="hide_on_dashboard" class="me-4"/>
<label for="support_document" class="me-4" string="Require Supporting Document"/>
<label for="elligible_for_accrual_rate" class="me-4"/>
<label for="allow_request_on_top" class="me-4" invisible="time_type == 'leave'"/>
</div>
<div class="d-flex flex-column gap-1">
<field name="include_public_holidays_in_duration" class="mb-2" nolabel="1"/>
<field name="hide_on_dashboard" class="mb-2" nolabel="1"/>
<field name="support_document" nolabel="1"/>
<field name="elligible_for_accrual_rate" nolabel="1" readonly="time_type != 'leave'"/>
<field name="allow_request_on_top" nolabel="1" invisible="time_type == 'leave'"/>
</div>
</div>
</group>
<group colspan="2">
<field name="color" widget="color_picker" />
<field class="o_time_off_icon_types d-flex flex-wrap" name="icon_id" widget="hr_holidays_radio_image" options="{'horizontal': true}"/>
<group>
<group name="negative_cap" id="negative_cap" string="Negative Cap"
invisible="not requires_allocation" colspan="2">
<div class="o_row o_cell o_wrap_label text-break text-900" colspan="2">
<label for="allows_negative" class="me-4" readonly="0"/>
<field name="allows_negative" nolabel="1"/>
<div invisible="not allows_negative">
<span class="mx-2">up to</span>
<field name="max_allowed_negative" class="oe_inline"/>
<span class="mx-2" invisible="request_unit == 'hour'">days</span>
<span class="mx-2" invisible="request_unit != 'hour'">hours</span>
</div>
</div>
</group>
</group>
</group>
<group name="visual" id="visual" string="Display Option" class="mw-100 col-lg-12">
<field name="color" widget="color_picker" />
<field class="o_time_off_icon_types d-flex flex-wrap" name="icon_id" widget="hr_holidays_radio_image" options="{'horizontal': true}"/>
</group>
</sheet>
</form>
</field>
@ -97,15 +137,11 @@
<field name="arch" type="xml">
<kanban class="o_kanban_mobile">
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_global_click">
<div>
<strong><field name="name"/></strong>
</div>
<div>
<span>Max Time Off: <field name="max_leaves"/></span>
<span class="float-end">Time Off Taken: <field name="leaves_taken"/></span>
</div>
<t t-name="card">
<field class="fw-bold" name="name"/>
<div>
Max Time Off: <field name="max_leaves"/>
<span class="float-end">Time Off Taken: <field name="leaves_taken"/></span>
</div>
</t>
</templates>
@ -114,26 +150,29 @@
</record>
<record id="view_holiday_status_normal_tree" model="ir.ui.view">
<field name="name">hr.leave.type.normal.tree</field>
<field name="name">hr.leave.type.normal.list</field>
<field name="model">hr.leave.type</field>
<field name="arch" type="xml">
<tree string="Time Off Type">
<list string="Time Off Type" multi_edit="1">
<field name="sequence" widget="handle"/>
<field name="display_name"/>
<field name="allocation_validation_type"/>
<field name="employee_requests" optional="hide"/>
<field name="request_unit" optional="hide"/>
<field name="leave_validation_type" optional="hide" string="Time Off Approval"/>
<field name="responsible_ids" widget="many2many_tags" invisible="leave_validation_type in ['no_validation', 'manager'] and (not requires_allocation or allocation_validation_type != 'hr')" optional="hide"/>
<field name="requires_allocation" optional="hide"/>
<field name="leave_validation_type" optional="hide"/>
<field name="company_id" groups="base.group_multi_company" optional="hide"/>
</tree>
<field name="allocation_validation_type" string="Allocation Approval"/>
<field name="employee_requests" optional="hide"/>
<field name="color" widget="color_picker" optional="hide"/>
<field name="company_id" groups="base.group_multi_company" optional="show" readonly="is_used"/>
<field name="country_id" groups="base.group_multi_company" optional="show" readonly="company_id or is_used"/>
</list>
</field>
</record>
<record id="open_view_holiday_status" model="ir.actions.act_window">
<field name="name">Time Off Types</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.leave.type</field>
<field name="view_mode">tree,kanban,form</field>
<field name="view_mode">list,kanban,form</field>
</record>
</odoo>

View file

@ -4,10 +4,11 @@
<record id="hr_employee_action_from_department" model="ir.actions.act_window">
<field name="name">Absent Employees</field>
<field name="res_model">hr.employee</field>
<field name="view_mode">tree,kanban,form</field>
<field name="view_mode">list,kanban,form</field>
<field name="context">{
'search_default_is_absent': 1,
'search_default_on_timeoff': 1,
'searchpanel_default_department_id': active_id,
'search_default_department_id': active_id,
'default_department_id': active_id}
</field>
<field name="search_view_id" ref="hr.view_employee_filter"/>
@ -22,50 +23,42 @@
<data>
<xpath expr="//templates" position="before">
<t groups="hr_holidays.group_hr_holidays_user">
<field name="leave_to_approve_count"/>
<field name="allocation_to_approve_count"/>
<field name="total_employee"/>
<field name="absence_of_today"/>
</t>
</xpath>
<xpath expr="//div[hasclass('o_kanban_primary_right')]" position="inside">
<t groups="hr_holidays.group_hr_holidays_user">
<div t-if="record.leave_to_approve_count.raw_value > 0" class="row ml16">
<div class="col">
<a name="action_open_leave_department" type="object">
<field name="leave_to_approve_count"/> Time Off Requests
</a>
</div>
</div>
<div t-if="record.allocation_to_approve_count.raw_value > 0" class="row ml16">
<div class="col">
<a name="action_open_allocation_department" type="object">
<field name="allocation_to_approve_count"/> Allocation Requests
</a>
</div>
</div>
</t>
<xpath expr="//div[@name='kanban_primary_right']" position="inside">
<div t-if="record.leave_to_approve_count.raw_value > 0" class="row ml32 g-0" groups="hr_holidays.group_hr_holidays_user">
<a name="action_open_leave_department" class="col" type="object">
<field name="leave_to_approve_count" groups="hr_holidays.group_hr_holidays_user"/> Time Off Requests
</a>
</div>
<div t-if="record.allocation_to_approve_count.raw_value > 0" class="row ml32 g-0" groups="hr_holidays.group_hr_holidays_user">
<a name="action_open_allocation_department" class="col" type="object">
<field name="allocation_to_approve_count" groups="hr_holidays.group_hr_holidays_user"/> Allocation Requests
</a>
</div>
</xpath>
<xpath expr="//div[hasclass('o_kanban_card_lower_content')]" position="inside">
<t groups="hr_holidays.group_hr_holidays_user">
<div class="row o_kanban_primary_bottom bottom_block bg-view"
t-if="record.absence_of_today.raw_value > 0">
<div class="col-3">
<a name="%(hr_employee_action_from_department)d" type="action" title="Absent Employee(s), Whose time off requests are either confirmed or validated on today">Absence</a>
</div>
<div class="col-9">
<field name="absence_of_today" widget="progressbar" options="{'current_value': 'absence_of_today', 'max_value': 'total_employee', 'editable': false}"/>
</div>
<xpath expr="//div[@name='kanban_card_lower_content']" position="inside">
<div class="row g-0 border-top border-1 mt-2 pt-2 mx-n2 bg-view"
t-if="record.absence_of_today.raw_value > 0" groups="hr_holidays.group_hr_holidays_user">
<div class="col-3 ms-3">
<a name="%(hr_employee_action_from_department)d" type="action" title="Absent Employee(s), Whose time off requests are either confirmed or validated on today">Absence</a>
</div>
</t>
<div class="col-7">
<field name="absence_of_today" widget="progressbar" options="{'current_value': 'absence_of_today', 'max_value': 'total_employee', 'editable': false}"/>
</div>
</div>
</xpath>
<xpath expr="//div[hasclass('o_kanban_manage_reports')]" position="inside">
<a role="menuitem" class="dropdown-item" name="%(hr_leave_action_action_department)d" type="action" groups="hr_holidays.group_hr_holidays_user">
Time Off
</a>
<div role="menuitem">
<a class="dropdown-item" name="%(hr_leave_report_action)d" type="action">
Time Off
</a>
</div>
</xpath>
</data>
</field>
@ -77,8 +70,13 @@
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_filter"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='job_id']" position="after">
<filter name="is_absent" string="Absent Today" domain="[('is_absent', '=', True)]"/>
<xpath expr="//filter[@name='my_team']" position="before">
<filter name="at_work" string="At work" domain="[('is_absent', '=', False)]"/>
<filter name="on_timeoff" string="On Time Off" domain="[('is_absent', '=', True)]"/>
<separator/>
</xpath>
<xpath expr="//separator[@name='secondary_groupby_separator']" position="after">
<filter name="group_leave_manager" string="Time Off Approver" context="{'group_by': 'leave_manager_id'}"/>
</xpath>
</field>
</record>
@ -92,22 +90,6 @@
<xpath expr="//templates" position="before">
<field name="is_absent"/>
</xpath>
<xpath expr="//strong[hasclass('o_kanban_record_title')]" position="inside"
t-if="record.show_hr_icon_display.raw_value">
<!-- Employee is absent, in holiday but he is connected -->
<div class="float-end"
t-if="record.hr_icon_display.raw_value == 'presence_holiday_present'">
<span class="fa fa-plane text-success" role="img" aria-label="Present but on leave"
title="Present but on leave" name="presence_absent_active">
</span>
</div>
<!-- Employee is on holiday, not present and not connected -->
<div class="float-end"
t-if="record.hr_icon_display.raw_value == 'presence_holiday_absent'"
name="presence_absent">
<span class="fa fa-plane text-warning" role="img" aria-label="To define" title="On Leave"/>
</div>
</xpath>
</field>
</record>
@ -123,30 +105,8 @@
<field name="leave_date_to"/>
<field name="is_absent"/>
</xpath>
<xpath expr="//div[@name='presence_absent_active']" position="after"
t-if="record.show_hr_icon_display.raw_value">
<!-- Employee is absent, in holiday but he is connected -->
<!-- green plane -->
<div class="float-end"
t-if="record.hr_icon_display.raw_value == 'presence_holiday_present'">
<span class="fa fa-plane text-success" role="img" aria-label="Present but on leave"
title="Present but on leave" name="presence_absent_active">
</span>
</div>
<!-- Employee is on holiday, not present and not connected -->
<!-- orange plane -->
<div class="float-end"
t-if="record.hr_icon_display.raw_value == 'presence_holiday_absent'"
name="presence_absent">
<span class="fa fa-plane text-warning" role="img" aria-label="To define" title="On Leave"/>
</div>
</xpath>
<xpath expr="//li[@id='last_login']" position="inside">
<span t-if="record.current_leave_id.raw_value" style="font-size: 100%"
t-att-class="record.current_leave_state.raw_value=='validate'?'oe_kanban_button oe_kanban_color_3':'oe_kanban_button oe_kanban_color_2'"
t-att-title="luxon.DateTime.fromISO(record.leave_date_from.raw_value).toFormat('ccc d MMM') + ' - ' + luxon.DateTime.fromISO(record.leave_date_to.raw_value).toFormat('ccc d MMM')">
<field name="current_leave_id"/>
</span>
<xpath expr="//field[@name='hr_icon_display']" position="attributes">
<attribute name="widget">hr_presence_status_private</attribute>
</xpath>
</field>
</record>
@ -156,80 +116,45 @@
<field name="name">hr.employee.leave.form.inherit</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name = "priority" eval="20" />
<field name="priority" eval="20"/>
<field name="arch" type="xml">
<xpath expr="//div[@id='hr_presence_status']" position="attributes">
<attribute name="attrs">
{'invisible': ['|', '|', ('last_activity', '=', False), ('user_id', '=', False), ('id', '=', False)]}
</attribute>
</xpath>
<xpath expr="//div[@id='hr_presence_status']" position="inside">
<!-- Employee is absent, in holiday but he is connected -->
<div role="img" class="fa fa-fw fa-plane text-success o_button_icon hr_presence" attrs="{'invisible': [('hr_icon_display', '!=', 'presence_holiday_present')]}" aria-label="Present but on leave" title="Present but on leave" name="presence_absent_active"/>
<!-- Employee is on holiday, not present and not connected -->
<div role="img" class="fa fa-fw fa-plane text-warning o_button_icon hr_presence" attrs="{'invisible': [('hr_icon_display', '!=', 'presence_holiday_absent')]}" aria-label="On Leave" title="On Leave" name="presence_absent"/>
</xpath>
<xpath expr="//group[@name='managers']" position="inside">
<field name="leave_manager_id"/>
<field name="leave_manager_id" string="Time Off" widget="many2one_avatar_user"/>
</xpath>
<xpath expr="//group[@name='managers']" position="attributes">
<attribute name="invisible">0</attribute>
<xpath expr="//field[@name='hr_icon_display']" position="attributes">
<attribute name="widget">hr_presence_status_private</attribute>
</xpath>
<xpath expr="//div[@name='button_box']" position="inside">
<button name="action_open_versions" position="before">
<field name="show_leaves" invisible="1"/>
<field name="is_absent" invisible="1"/>
<field name="hr_icon_display" invisible="1"/>
<button name="action_time_off_dashboard"
type="object"
class="oe_stat_button"
context="{'search_default_employee_ids': active_id}"
attrs="{'invisible': [('is_absent', '=', False)]}">
<div attrs="{'invisible': [('hr_icon_display', '!=', 'presence_holiday_present')]}"
role="img" class="fa fa-fw fa-plane o_button_icon text-success" aria-label="Off Till" title="Off Till"/>
<div attrs="{'invisible': [('hr_icon_display', '!=', 'presence_holiday_absent')]}" role="img"
class="fa fa-fw fa-plane o_button_icon text-warning" aria-label="Off Till" title="Off Till"/>
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">
Off Till
</span>
<span class="o_stat_value">
<field name="leave_date_to"/>
</span>
</div>
</button>
<button name="action_time_off_dashboard"
type="object"
class="oe_stat_button"
icon="fa-calendar"
attrs="{'invisible': [('show_leaves','=', False)]}"
context="{'search_default_employee_ids': active_id}"
invisible="not show_leaves or company_id not in allowed_company_ids"
groups="base.group_user"
help="Remaining leaves">
<div class="o_field_widget o_stat_info" attrs="{'invisible': [('allocation_display', '=', '0')]}">
<span class="o_stat_value">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value" invisible="allocation_display == '0'">
<field name="allocation_remaining_display"/>/<field name="allocation_display"/> Days
</span>
<span class="o_stat_text">
Time Off
</span>
</div>
<div class="o_field_widget o_stat_info" attrs="{'invisible': [('allocation_display', '!=', '0')]}">
<span class="o_stat_text">
Time Off
</span>
</div>
</button>
</xpath>
</button>
</field>
</record>
<record id="view_employee_tree_inherit_leave" model="ir.ui.view">
<field name="name">hr.employee.tree.leave</field>
<field name="name">hr.employee.list.leave</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='work_location_id']" position="after">
<field name="leave_manager_id" optional="hide" string="Time Off Approver"/>
<field name="leave_manager_id" optional="hide" widget="many2one_avatar_user"/>
</xpath>
</field>
</record>
@ -239,84 +164,30 @@
<field name="model">hr.employee.public</field>
<field name="inherit_id" ref="hr.hr_employee_public_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='coach_id']" position="after">
<field name="company_id" invisible="1"/>
<field name="leave_manager_id"/>
</xpath>
<xpath expr="//div[@name='button_box']" position="inside">
<field name="show_leaves" invisible="1"/>
<field name="is_absent" invisible="1"/>
<field name="hr_icon_display" invisible="1"/>
<button disabled="1"
<button name="action_open_time_off_calendar"
type="object"
class="oe_stat_button"
attrs="{'invisible': [('is_absent', '=', False)]}">
<div role="img" attrs="{'invisible': [('hr_icon_display', '!=', 'presence_holiday_present')]}"
class="fa fa-fw fa-plane o_button_icon text-success" aria-label="Off Till" title="Off Till"/>
<div attrs="{'invisible': [('hr_icon_display', '!=', 'presence_holiday_absent')]}" role="img"
class="fa fa-fw fa-plane o_button_icon text-warning" aria-label="Off Till" title="Off Till"/>
icon="fa-calendar"
invisible="show_leaves"
groups="base.group_user"
help="Remaining leaves">
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">
Off Till
</span>
<span class="o_stat_value">
<field name="leave_date_to"/>
Time Off
</span>
</div>
</button>
</xpath>
</field>
</record>
<record id="res_users_view_form" model="ir.ui.view">
<field name="name">hr.user.preferences.view.form.leave.inherit</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="hr.res_users_view_form_profile"/>
<field name="arch" type="xml">
<xpath expr="//header" position="inside">
<button name="%(hr_leave_action_new_request)d"
string="Request Time off"
type="action"
class="btn btn-primary"/>
<button name="%(hr_leave_allocation_action_my)d"
string="Request Allocation"
type="action"
class="btn btn-primary"/>
</xpath>
<xpath expr="//group[@name='managers']" position="inside">
<field name="leave_manager_id" attrs="{'readonly': [('can_edit', '=', False)]}"/>
</xpath>
<xpath expr="//group[@name='managers']" position="attributes">
<attribute name="invisible">0</attribute>
</xpath>
<xpath expr="//div[@name='button_box']" position="inside">
<field name="show_leaves" invisible="1"/>
<field name="employee_ids" invisible="1"/>
<field name="is_absent" invisible="1"/>
<field name="hr_icon_display" invisible="1"/>
<button name="%(hr_leave_action_new_request)d" type="action"
class="oe_stat_button"
invisible="context.get('from_my_profile', False)"
attrs="{'invisible': [('is_absent', '=', False)]}">
<div attrs="{'invisible': [('hr_icon_display', '!=', 'presence_holiday_present')]}"
role="img" class="fa fa-fw fa-plane o_button_icon text-success" aria-label="Off Till"
title="Off Till"/>
<div attrs="{'invisible': [('hr_icon_display', '!=', 'presence_holiday_absent')]}"
role="img" class="fa fa-fw fa-plane o_button_icon text-warning" aria-label="Off Till"
title="Off Till"/>
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">
Off Till
</span>
<span class="o_stat_value">
<field name="leave_date_to"/>
</span>
</div>
</button>
<button name="%(hr_leave_action_new_request)d"
type="action"
class="oe_stat_button"
icon="fa-calendar"
attrs="{'invisible': [('show_leaves','=', False)]}"
invisible="not is_user or not show_leaves"
groups="base.group_user"
help="Remaining leaves">
<div class="o_field_widget o_stat_info">

View file

@ -4,7 +4,7 @@
<record id="mail_activity_type_action_config_hr_holidays" model="ir.actions.act_window">
<field name="name">Activity Types</field>
<field name="res_model">mail.activity.type</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,kanban,form</field>
<field name="domain">['|', ('res_model', '=', False), ('res_model', 'in', ['hr.leave', 'hr.leave.allocation'])]</field>
<field name="context">{'default_res_model': 'hr.leave'}</field>
<field name="help" type="html">

View file

@ -17,44 +17,48 @@
<field name="inherit_id" ref="resource.resource_calendar_leave_form"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="holiday_id"/>
<field name="holiday_id" options="{'no_quick_create': True}"/>
</field>
</field>
</record>
<record id="resource_calendar_leaves_tree_inherit" model="ir.ui.view">
<field name="name">resource.calendar.leaves.tree.inherit</field>
<field name="name">resource.calendar.leaves.list.inherit</field>
<field name="model">resource.calendar.leaves</field>
<field name="inherit_id" ref="resource.resource_calendar_leave_tree"/>
<field name="mode">primary</field>
<field name="priority">10</field>
<field name="arch" type="xml">
<xpath expr="//tree" position="attributes">
<xpath expr="//list" position="attributes">
<attribute name="editable">bottom</attribute>
</xpath>
<xpath expr="//field[@name='name']" position="attributes">
<attribute name="string">Name</attribute>
<attribute name="required">1</attribute>
<attribute name="placeholder">e.g. New Year's Day</attribute>
</xpath>
<xpath expr="//field[@name='resource_id']" position="attributes">
<attribute name="invisible">1</attribute>
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='date_to']" position="after">
<field name="company_id" invisible="1"/>
<field name="company_id" column_invisible="True"/>
<xpath expr="//field[@name='calendar_id']" position="move"/>
</xpath>
<xpath expr="//field[@name='calendar_id']" position="attributes">
<attribute name="placeholder">All Schedules</attribute>
</xpath>
</field>
</record>
<record id="resource_calendar_global_leaves_action_from_calendar" model="ir.actions.act_window">
<field name="name">Resource Time Off</field>
<field name="name">Public Holidays</field>
<field name="res_model">resource.calendar.leaves</field>
<field name="view_mode">tree</field>
<field name="view_mode">list</field>
<field name="view_id" ref="resource_calendar_leaves_tree_inherit"/>
<field name="domain">['&amp;', ('resource_id', '=', False), ('calendar_id', 'in', (active_id, False))]</field>
<field name="domain">[('resource_id', '=', False)]</field>
<field name="context">{
'default_calendar_id': active_id,
'search_default_filter_date': True}</field>
'search_default_calendar_id': active_id}</field>
<field name="search_view_id" ref="hr_holidays.resource_calendar_leaves_view_search_inherit"/>
</record>
@ -68,10 +72,7 @@
icon="fa-sun-o" class="oe_stat_button">
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">
<field name="associated_leaves_count"/> Public
</span>
<span class="o_stat_text">
Time Off
<field name="associated_leaves_count" string="Public Holidays" widget="statinfo"/>
</span>
</div>
</button>
@ -81,12 +82,29 @@
<record id="open_view_public_holiday" model="ir.actions.act_window">
<field name="name">Public Holidays</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">resource.calendar.leaves</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
<field name="domain">[('resource_id', '=', False)]</field>
<field name="view_id" ref="resource_calendar_leaves_tree_inherit"/>
<field name="context">{
'search_default_filter_date': True}</field>
<field name="context">{'search_default_filter_date': True}</field>
<field name="help" type="html">
<p class="o_view_nocontent_empty_folder">
No Public Holidays yet!
</p>
<p>
Public Holidays are non-working days that don't impact employees' balances
</p>
</field>
</record>
</odoo>
<record id="resource_calendar_view_tree" model="ir.ui.view">
<field name="name">resource.calendar.view.list.inherit.hr.holidays</field>
<field name="model">resource.calendar</field>
<field name="inherit_id" ref="resource.view_resource_calendar_tree"/>
<field name="arch" type="xml">
<field name="work_resources_count" position="after">
<field name="associated_leaves_count" string="# Public Holidays" optional="hide"/>
</field>
</field>
</record>
</odoo>