Files
odoo-usability/hr_holidays_usability/hr_holidays_view.xml
2017-06-09 13:09:37 +02:00

214 lines
10 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 Akretion (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<record id="edit_holiday_new" model="ir.ui.view">
<field name="name">hr_holidays_usability.leave_request_form</field>
<field name="model">hr.holidays</field>
<field name="inherit_id" ref="hr_holidays.edit_holiday_new"/>
<field name="arch" type="xml">
<field name="date_from" position="attributes">
<attribute name="required">0</attribute>
</field>
<field name="date_to" position="attributes">
<attribute name="required">0</attribute>
</field>
<xpath expr="//field[@name='date_from']/.." position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<field name="number_of_days_temp" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="number_of_days_temp" position="after">
<field name="number_of_days_remove" class="oe_inline"/>
</field>
<field name="holiday_status_id" position="after">
<field name="vacation_date_from" on_change="vacation_from(vacation_date_from, vacation_time_from, context)" required="1"/>
<field name="vacation_time_from" on_change="vacation_from(vacation_date_from, vacation_time_from, context)" required="1"/>
<field name="vacation_date_to" on_change="vacation_to(vacation_date_to, vacation_time_to, context)" required="1"/>
<field name="vacation_time_to" on_change="vacation_to(vacation_date_to, vacation_time_to, context)" required="1"/>
</field>
<xpath expr="//field[@name='department_id']/.." position="after">
<group string="Counter for this leave type" name="counters" attrs="{'invisible': [('limit', '=', True)]}">
<field name="limit" invisible="1"/>
<label for="total_allocated_leaves"/>
<div>
<field name="total_allocated_leaves" class="oe_inline"/>
<label string=" days" class="oe_inline"/>
</div>
<label for="current_leaves_taken"/>
<div>
<field name="current_leaves_taken" class="oe_inline"/>
<label string=" days" class="oe_inline"/>
</div>
<label for="current_remaining_leaves"/>
<div>
<field name="current_remaining_leaves" class="oe_inline"/>
<label string=" days" class="oe_inline"/>
</div>
</group>
</xpath>
<field name="department_id" position="after">
<field name="posted_date" groups="base.group_hr_user"/>
</field>
</field>
</record>
<record id="view_holiday" model="ir.ui.view">
<field name="name">hr_holidays_usability.leave_request_tree</field>
<field name="model">hr.holidays</field>
<field name="inherit_id" ref="hr_holidays.view_holiday"/>
<field name="arch" type="xml">
<field name="number_of_days" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="number_of_days" position="after">
<field name="number_of_days_remove" sum="Total Days of Vacation"/>
</field>
<field name="date_from" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="date_from" position="after">
<field name="vacation_date_from"/>
<field name="vacation_time_from"/>
</field>
<field name="date_to" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="date_to" position="after">
<field name="vacation_date_to"/>
<field name="vacation_time_to"/>
</field>
<field name="holiday_status_id" position="attributes">
<attribute name="invisible">0</attribute>
</field>
<field name="holiday_status_id" position="after">
<field name="posted_date" groups="base.group_hr_user"/>
</field>
</field>
</record>
<record id="edit_holiday_status_form" model="ir.ui.view">
<field name="name">hr_holidays_usability.hr.holidays.status.form</field>
<field name="model">hr.holidays.status</field>
<field name="inherit_id" ref="hr_holidays.edit_holiday_status_form"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="vacation_compute_method"/>
</field>
</field>
</record>
<record id="view_holiday_status_normal_tree" model="ir.ui.view">
<field name="name">hr_holidays_usability.hr.holidays.status.normal.tree</field>
<field name="model">hr.holidays.status</field>
<field name="inherit_id" ref="hr_holidays.view_holiday_status_normal_tree"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="vacation_compute_method"/>
</field>
</field>
</record>
<!-- On the leave requests, put tree view by default instead of calendar -->
<record id="hr_holidays.action_open_ask_holidays_calendar" model="ir.actions.act_window.view">
<field name="sequence" eval="5"/>
</record>
<record id="resource_calendar_leaves_cal_first_action" model="ir.actions.act_window">
<field name="name">Leaves Calendar</field>
<field name="res_model">resource.calendar.leaves</field>
<field name="view_mode">calendar,tree,form</field>
</record>
<!-- Warning: when you have mrp installed, there is an ACL that gives write/create access to MRP Users on resource.calendar.leaves You should inherit this ACL with XMLID mrp.access_resource_calendar_leaves_user to give only read access:
mrp.access_resource_calendar_leaves_user,only read access to manufacuting user,resource.model_resource_calendar_leaves,mrp.group_mrp_user,1,0,0,0
-->
<!-- When you have a balance of legal leaves of 0.1 (for example), you cannot 'use'
it because this module only allows you to use 0.5, 1, 1.5, ...
So, if you want to "cleanup" this balance of 0.1, you should declare a leave of 0.1
and an allocation of 0.1 on a newer legal leave
This menu entry is designed for this and only accessible to HR Manager -->
<record id="hr_holidays_leave_force_number_form" model="ir.ui.view">
<field name="name">Leave request force qty</field>
<field name="model">hr.holidays</field>
<field name="arch" type="xml">
<form string="Leave Request Force Qty" version="7.0">
<header>
<button string="Approve" name="validate" states="confirm" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
<button string="Validate" name="second_validate" states="validate1" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
<button string="Refuse" name="refuse" states="confirm,validate,validate1" type="workflow" groups="base.group_hr_user"/>
<button string="Reset to New" name="set_to_draft" states="cancel,refuse" type="object" groups="base.group_hr_user"/>
<field name="state" widget="statusbar" statusbar_visible="draft,confirm,validate" statusbar_colors='{"confirm":"blue","validate1":"blue","refuse":"red"}'/>
</header>
<sheet>
<group>
<group>
<field name="name" required="1" attrs="{'readonly':[('state','!=','draft'),('state','!=','confirm')]}"/>
<field name="holiday_status_id" context="{'employee_id':employee_id}"/>
<label for="number_of_days_temp" string="Leave"/>
<div>
<field name="number_of_days_temp" class="oe_inline"/> days
</div>
</group>
<group>
<field name="holiday_type" on_change="onchange_type(holiday_type)" context="{'employee_id':employee_id}" />
<field name="employee_id" attrs="{'required':[('holiday_type','=','employee')], 'invisible':[('holiday_type','=','category')]}"/>
<field name="category_id" attrs="{'required':[('holiday_type','=','category')], 'invisible':[('holiday_type','=','employee')]}"/>
<field name="department_id" attrs="{'invisible':[('holiday_type','=','category')]}"/>
</group>
</group>
<field name="notes" nolabel="1" colspan="4" placeholder="Add a reason..."/>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<record id="hr_holidays_leave_force_number_action" model="ir.actions.act_window">
<field name="name">Leave Requests Force Qty</field>
<field name="res_model">hr.holidays</field>
<field name="view_mode">tree,form</field>
<field name="context">{'default_type': 'remove'}</field>
<field name="domain">[('type','=','remove')]</field>
</record>
<record id="hr_holidays_leave_force_number_tree_act_window_view" model="ir.actions.act_window.view">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_holiday"/>
<field name="act_window_id" ref="hr_holidays_leave_force_number_action"/>
</record>
<record id="hr_holidays_leave_force_number_form_act_window_view" model="ir.actions.act_window.view">
<field name="sequence" eval="2"/>
<field name="view_mode">form</field>
<field name="view_id" ref="hr_holidays_leave_force_number_form"/>
<field name="act_window_id" ref="hr_holidays_leave_force_number_action"/>
</record>
<menuitem id="hr_holidays_leave_force_number_menu" action="hr_holidays_leave_force_number_action" parent="hr_holidays.menu_open_ask_holidays" sequence="15" groups="base.group_hr_manager"/>
<menuitem id="resource_calendar_leaves_cal_first_menu"
action="resource_calendar_leaves_cal_first_action"
parent="hr_holidays.menu_open_ask_holidays" sequence="50"/>
<record id="hr_holidays.menu_open_company_allocation" model="ir.ui.menu">
<field name="groups_id" eval="[(4, ref('base.group_hr_user'))]"/>
</record>
</data>
</openerp>