flectra/addons/hr_attendance/views/hr_employee_view.xml
2018-01-16 02:34:37 -08:00

112 lines
5.6 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<flectra>
<record id="view_employee_form_inherit_hr_attendance" model="ir.ui.view">
<field name="name">hr.employee</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="priority">10</field>
<field name="groups_id" eval="[(4,ref('hr_attendance.group_hr_attendance_user'))]"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='toggle_active']" position="before">
<field name="attendance_state" invisible="1"/>
<button name="%(hr_attendance_action_employee)d"
class="oe_stat_button"
type="action" attrs="{'invisible': [('attendance_state', '=', False)]}">
<div id="oe_hr_attendance_status" class="fa fa-fw fa-user o_button_icon oe_hr_attendance_status_green" attrs="{'invisible': [('attendance_state', '=', 'checked_out')]}"/>
<div id="oe_hr_attendance_status" class="fa fa-fw fa-user o_button_icon oe_hr_attendance_status_red" attrs="{'invisible': [('attendance_state', '=', 'checked_in')]}"/>
<div class="o_stat_info">
<span class="o_stat_text">Attendance</span>
</div>
</button>
</xpath>
<xpath expr="//group[@name='active_group']" position="after">
<group string='Attendance' groups="hr_attendance.group_hr_attendance_user">
<field name="barcode"/>
<field name="pin" groups="hr_attendance.group_hr_attendance_use_pin"/>
<field name="manual_attendance" attrs="{'invisible': [('user_id', '=', False)]}"/>
</group>
</xpath>
</field>
</record>
<!-- employee kanban view specifically for hr_attendance (to check in/out) -->
<record id="hr_employees_view_kanban" model="ir.ui.view">
<field name="name">hr.employee.kanban</field>
<field name="model">hr.employee</field>
<field name="priority">99</field>
<field name="arch" type="xml">
<kanban class="o_hr_employee_attendance_kanban" create="false">
<field name="attendance_state"/>
<field name="id"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
<img t-att-src="kanban_image('hr.employee', 'image_medium', record.id.raw_value)"/>
</div>
<div class="oe_kanban_details">
<div id="textbox">
<div class="pull-right" t-if="record.attendance_state.raw_value == 'checked_in'">
<span id="oe_hr_attendance_status" class="fa fa-user oe_hr_attendance_status_green"></span>
</div>
<div class="pull-right" t-if="record.attendance_state.raw_value == 'checked_out'">
<span id="oe_hr_attendance_status" class="fa fa-user oe_hr_attendance_status_red"></span>
</div>
<strong>
<field name="name"/>
</strong>
</div>
<ul>
<li t-if="record.job_id.raw_value"><field name="job_id"/></li>
<li t-if="record.work_location.raw_value"><field name="work_location"/></li>
</ul>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="view_employee_kanban_inherit_hr_attendance" model="ir.ui.view">
<field name="name">hr.employee</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.hr_kanban_view_employees"/>
<field name="priority">1</field>
<field name="arch" type="xml">
<templates position="before">
<field name="attendance_state"/>
</templates>
<field name="name" position="replace">
<div>
<div class="pull-right" t-if="record.attendance_state.raw_value == 'checked_in'">
<span id="oe_hr_attendance_status" class="fa fa-user oe_hr_attendance_status_green"></span>
</div>
<div class="pull-right" t-if="record.attendance_state.raw_value == 'checked_out'">
<span id="oe_hr_attendance_status" class="fa fa-user oe_hr_attendance_status_red"></span>
</div>
<strong>
<field name="name" placeholder="Employee's Name"/>
</strong>
</div>
</field>
</field>
</record>
<record id="hr_employee_attendance_action_kanban" model="ir.actions.act_window">
<field name="name">Employees</field>
<field name="res_model">hr.employee</field>
<field name="view_mode">kanban</field>
<field name="view_id" ref="hr_employees_view_kanban"/>
<field name="help" type="html">
<p>
Create a few employees to be able to select an employee here and perform his check in / check out.
</p>
<p>
To create employees go to the Employees menu.
</p>
</field>
</record>
</flectra>