hr_holidays/views/hr_leave_accrual_views.xml
2024-04-12 12:15:30 +03:00

265 lines
17 KiB
XML

<?xml version='1.0' encoding='UTF-8' ?>
<odoo>
<record id="hr_accrual_level_view_form" model="ir.ui.view">
<field name="name">hr.leave.accrual.level.form</field>
<field name="model">hr.leave.accrual.level</field>
<field name="arch" type="xml">
<form string="Accrual Level">
<sheet>
<group name="accrue" col="1" width="800px">
<div class="o_td_label">
<label for="added_value" string="Employee accrue"/>
</div>
<div>
<field name="accrued_gain_time" invisible="1"/>
<field name="can_modify_value_type" invisible="1"/>
<field name="added_value" widget="FloatWithoutTrailingZeros" style="width: 4rem" class="me-1"/>
<field name="added_value_type" style="width: 3.4rem" nolabel="1" readonly="not can_modify_value_type"/>
</div>
<div style="width: 5rem"/>
<div name="hourly" invisible="frequency != 'hourly'">
<field name="frequency" style="width: 5rem"/>
</div>
<div name="daily" invisible="frequency != 'daily'">
<field name="frequency" style="width: 5rem"/>
</div>
<div name="weekly" invisible="frequency != 'weekly'">
<field name="frequency" style="width: 4.5rem;"/>
<label for="week_day" string="on" class="me-1"/><field name="week_day" style="width: 6.6rem"/>
</div>
<div name="monthly" invisible="frequency != 'monthly'">
<field name="frequency" style="width: 4.5rem"/>
<label for="first_day_display" string="on the" class="me-1"/>
<field name="first_day_display" required="1" style="width: 4rem"/>
of the month
</div>
<div name="bimonthly" invisible="frequency != 'bimonthly'" style="width: 100%">
<field name="frequency" style="width: 7rem"/>
<label for="first_day_display" string="on the" class="me-1"/><field name="first_day_display" required="1" style="width: 4rem"/>
<label for="second_day_display" string="and on the" class="me-1"/><field name="second_day_display" required="1" style="width: 4.1rem"/>
of the month
</div>
<div name="biyearly" invisible="frequency != 'biyearly'">
<field name="frequency" style="width: 6rem"/>
<label for="first_month_day_display" string="on the" class="me-1"/>
<field name="first_month_day_display" required="1" style="width: 4.1rem"/>of <field name="first_month" required="1" style="width: 4.55rem"/>
<label for="second_month_day_display" string="and" class="me-1"/>
<field name="second_month_day_display" required="1" style="width: 4.1rem"/>of <field name="second_month" required="1" style="width: 5.4rem"/>
</div>
<div name="yearly" invisible="frequency != 'yearly'">
<field name="frequency" style="width: 4rem"/>
<label for="yearly_day_display" string="on the" class="me-1"/>
<field name="yearly_day_display" required="1" style="width: 4rem"/> of <field name="yearly_month" required="1" style="width: 5.4rem"/>
</div>
</group>
<group name="maximum_leave">
<field name="cap_accrued_time" style="width: 9.35rem"/>
<div style="width: 9.35rem"/>
<div invisible="not cap_accrued_time">
<field name="maximum_leave" style="width: 5rem" widget="FloatWithoutTrailingZeros"/>
<field name="added_value_type" style="white-space: nowrap;width: 5rem"/>
</div>
</group>
<group name="milestone">
<div class="o_td_label">
<label for="start_count" string="Milestone reached"/>
</div>
<div>
<field name="start_count" style="width: 2rem"/>
<field name="start_type" style="width: 4.75rem"/> after allocation start date
</div>
<div class="o_td_label">
<label for="action_with_unused_accruals" string="Carry over"/>
</div>
<div>
<field name="action_with_unused_accruals" class="o_light_label" style="font-weight: 0" widget="radio"/><br/>
<div invisible="action_with_unused_accruals != 'maximum'">
<label for="postpone_max_days" string="Up to"/>
<field name="postpone_max_days" style="width: 3rem"/>
<field name="added_value_type" nolabel="1" readonly="1" force_save="1" style="width: 5rem"/>
</div>
</div>
<field name="postpone_max_days" class="w-25" invisible="action_with_unused_accruals != 'postponed'"/>
</group>
</sheet>
</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="model">hr.leave.accrual.plan</field>
<field name="arch" type="xml">
<tree string="Accrual Plans">
<field name="name"/>
<field name="level_count"/>
<field name="time_off_type_id"/>
<field name="employees_count"/>
</tree>
</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="active" invisible="1"/>
<field name="show_transition_mode" invisible="1" />
<sheet>
<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">
<field name="employees_count" widget="statinfo"/>
</button>
</div>
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" invisible="active"/>
<group>
<group>
<field name="name"/>
<field name="accrued_gain_time" widget="radio"/>
<field name="carryover_date" widget="radio"/>
<label for="carryover_month" string="Carry-Over Date" invisible="carryover_date != 'other'"/>
<div name="carryover" invisible="carryover_date != 'other'">
<field name="carryover_day" invisible="1"/>
<field name="carryover_day_display" required="1" style="width: 4.75rem;"/> of
<field name="carryover_month" required="1" style="width: 6rem;"/>
</div>
</group>
<group>
<field name="is_based_on_worked_time" readonly="accrued_gain_time == 'start'"/>
<field name="transition_mode" widget="radio" invisible="not show_transition_mode"/>
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
</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" invisible="level_ids">
<p>
No rule has been set up for this accrual plan.
</p>
</div>
<field name="level_ids" mode="kanban" nolabel="1"
class="o_hr_holidays_plan_level_container"
widget="accrual_levels_one2many"
add-label="New Milestone"
>
<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="cap_accrued_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">
<t t-if="record.start_count.value > 0">
after <t t-esc="record.start_count.value"/> <t t-esc="record.start_type.value"/>
</t>
<t t-else="">
initially
</t>
</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>
<t t-name="level_content">
<div class="o_hr_holidays_card">
<div class="content container" style="width: 560px;">
<div class="row w-100">
<div class="pe-0 me-0" style="width: 6rem;">
<field name="added_value" widget="FloatWithoutTrailingZeros"/> <field name="added_value_type"/>,
</div>
<div class="col-auto m-0 p-0">
<field name="frequency" class="ms-1"/>
<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>
<div class="row text-muted">
<div class="pe-0 me-0" style="width: 6rem;">
Cap:
</div>
<div class="col-3 m-0 ps-1">
<t t-if="record.cap_accrued_time.value &amp;&amp; record.maximum_leave.value > 0">
<field name="maximum_leave" widget="FloatWithoutTrailingZeros"/> <field name="added_value_type"/>
</t>
<t t-else="">
Unlimited
</t>
</div>
</div>
<div class="row text-muted">
<div class="pe-0 me-0" style="width: 6rem;">
Carry over:
</div>
<div class="col-3 m-0 ps-1">
<t t-if="record.action_with_unused_accruals.raw_value === 'all'">all</t>
<t t-elif="record.action_with_unused_accruals.raw_value == 'maximum'">up to <field name="postpone_max_days" /> <t t-esc="record.added_value_type.raw_value" /></t>
<t t-else="">no</t>
</div>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</div>
</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="Group By">
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
<filter string="Time Off Type" name='time_off_type_id' context="{'group_by':'time_off_type_id'}"/>
<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="res_model">hr.leave.accrual.plan</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>