[MIG] hr_luncheon_voucher: migrate to 18.0

This commit is contained in:
Stéphan Sainléger
2026-05-30 00:34:22 +02:00
parent e4cc346dfe
commit cc719291eb
24 changed files with 1857 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_event_type_luncheonvoucher_tree" model="ir.ui.view">
<field name="name">event.type.luncheonvoucher</field>
<field name="model">calendar.event.type</field>
<field name="inherit_id" ref="calendar.view_calendar_event_type_tree" />
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="remove_luncheon_voucher" />
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_employee_form_lv" model="ir.ui.view">
<field name="name">hr.employee.form.lv</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form" />
<field name="arch" type="xml">
<header position="inside">
<button
type="object"
name="refresh_lv_values"
string="Refresh Luncheon Vouchers"
class="btn-secundary"
/>
</header>
<xpath expr="//div[@name='button_box']" position="inside">
<button
type="object"
name="action_lv_allocations"
class="oe_stat_button"
icon="fa-ticket"
>
<field
name="total_acquired_lv"
widget="statinfo"
string="Acquired"
/>
</button>
<button
type="object"
name="action_lv_allocations"
class="oe_stat_button"
icon="fa-ticket"
>
<field
name="distributed_lv"
widget="statinfo"
string="Distributed"
/>
</button>
<button
type="object"
name="action_lv_allocations"
class="oe_stat_button"
icon="fa-ticket"
>
<field name="dued_lv" widget="statinfo" string="Dued" />
</button>
</xpath>
<xpath expr="//page[@name='hr_settings']/group" position="inside">
<group name="luncheon_vouchers" string="Luncheon Vouchers">
<field name="default_monthly_lv" />
<field name="lv_allocations_ids" />
</group>
</xpath>
</field>
</record>
<record id="view_employee_tree_lv" model="ir.ui.view">
<field name="name">view_employee_tree_lv</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_tree" />
<field name="arch" type="xml">
<xpath expr="//list" position="inside">
<header>
<button
type="object"
name="action_lv_allocations_requests_wizard"
string="Generate Luncheon Vouchers Allocations"
class="btn-primary"
/>
</header>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="hr_lv_allocation_search" model="ir.ui.view">
<field name="name">hr.lv.allocation.search</field>
<field name="model">hr.lv.allocation</field>
<field name="arch" type="xml">
<search string="Luncheon vouchers allocations">
<field name="state" />
<field name="employee_id" context="{'search_all_campanies':True}" />
<field name="distrib_campaign_name" />
<filter
name="draft"
string="Draft"
domain="[('state', '=', 'draft')]"
/>
<filter
name="confirmed"
string="Confirmed"
domain="[('state', '=', 'confirmed')]"
/>
<filter
name="distributed"
string="Distributed"
domain="[('state', '=', 'distributed')]"
/>
</search>
</field>
</record>
<record id="hr_lv_allocation_tree" model="ir.ui.view">
<field name="name">hr.lv.allocation.list</field>
<field name="model">hr.lv.allocation</field>
<field name="arch" type="xml">
<list>
<header>
<button
type="object"
name="confirm_allocation"
string="Confirm"
class="btn-primary"
/>
<button
type="object"
name="distribute_allocation"
string="Distribute Vouchers"
class="btn-primary"
/>
<button
type="object"
name="back_to_draft"
string="Back to draft"
class="btn-secundary"
/>
<button
type="object"
name="adjust_distribution"
string="Adjust distribution"
class="btn-secundary"
/>
</header>
<field name="distrib_campaign_name" />
<field name="employee_id" />
<field name="state" />
<field name="date_from" widget="date" />
<field name="date_to" widget="date" />
<field name="number_acquired_lv" />
<field name="number_dued_lv" />
<field name="number_distributed_lv" />
<field name="lv_balance" />
</list>
</field>
</record>
<record id="hr_lv_allocation_form" model="ir.ui.view">
<field name="name">hr.lv.allocation.form</field>
<field name="model">hr.lv.allocation</field>
<field name="arch" type="xml">
<form string="">
<header>
<button
type="object"
name="confirm_allocation"
string="Confirm"
class="btn-primary"
invisible="state != 'draft'"
/>
<button
type="object"
name="distribute_allocation"
string="Distribute Vouchers"
class="btn-primary"
invisible="state != 'confirmed'"
/>
<button
type="object"
name="back_to_draft"
string="Back to draft"
class="btn-secundary"
invisible="state == 'draft'"
/>
<button
type="object"
name="adjust_distribution"
string="Adjust distribution"
class="btn-secundary"
invisible="state != 'draft'"
/>
</header>
<sheet>
<h1>
<field name="name" readonly="1" />
</h1>
<group string="Request context">
<field name="distrib_campaign_name" />
<field name="employee_id" />
<field name="state" />
<field name="date_from" widget="date" />
<field name="date_to" widget="date" />
</group>
<group string="Luncheon vouchers calculation">
<field name="number_acquired_lv" />
<field name="number_dued_lv" />
<field name="number_distributed_lv" />
</group>
</sheet>
</form>
</field>
</record>
<record id="act_lv_allocations" model="ir.actions.act_window">
<field name="name">Luncheon vouchers allocations</field>
<field name="res_model">hr.lv.allocation</field>
<field name="view_mode">list,form</field>
</record>
</odoo>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<menuitem
id="menu_hr_lv_allocations"
action="act_lv_allocations"
parent="hr.menu_hr_employee_payroll"
sequence="1"
name="Luncheon vouchers"
/>
</odoo>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="res_config_settings_lv_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.lv</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="99" />
<field name="inherit_id" ref="hr.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath
expr="//block[@name='employee_rights_setting_container']/.."
position="inside"
>
<h2>Employee Luncheon Vouchers</h2>
<div class="row mt16 o_settings_container" name="employee_lv_container">
<div
class="col-12 col-lg-6 o_setting_box"
id="employee_lv_halfday_cancel"
title="Luncheon Vouchers Half-day Cancel"
>
<div class="o_setting_left_pane">
<field name="hr_half_day_cancels_voucher" />
</div>
<div class="o_setting_right_pane">
<label for="hr_half_day_cancels_voucher" />
<div class="text-muted" name="hr_presence_options_advanced">
Voucher is acquired only if the employee worked during all his
attendance.
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>