[IMP] hr_attendance: allow to search for "signed in/out" employees

This commit is contained in:
Prakash Prajapati
2017-10-20 09:50:06 +02:00
committed by Richard Mathot
parent a25d604305
commit 2e038cc6bd
2 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ class HrEmployee(models.Model):
pin = fields.Char(string="PIN", default=_default_random_pin, help="PIN used to Check In/Out in Kiosk Mode (if enabled in Configuration).", copy=False)
attendance_ids = fields.One2many('hr.attendance', 'employee_id', help='list of attendances for the employee')
last_attendance_id = fields.Many2one('hr.attendance', compute='_compute_last_attendance_id')
last_attendance_id = fields.Many2one('hr.attendance', compute='_compute_last_attendance_id', store=True)
attendance_state = fields.Selection(string="Attendance", compute='_compute_attendance_state', selection=[('checked_out', "Checked out"), ('checked_in', "Checked in")])
manual_attendance = fields.Boolean(string='Manual Attendance', compute='_compute_manual_attendance', inverse='_inverse_manual_attendance',
help='The employee will have access to the "My Attendances" menu to check in and out from his session')
@@ -29,6 +29,19 @@
</field>
</record>
<!--Inherit employee search view -->
<record id="view_employee_filter_inherit_hr_attendance" model="ir.ui.view">
<field name="name">hr.employee.filter.inherit.attendance</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_filter"/>
<field name="arch" type="xml">
<xpath expr="//filter[@name='inactive']" position="after">
<filter string="Signed In" name="signed_in" domain="[('last_attendance_id.check_out', '=', False)]"/>
<filter string="Signed Out" name="signed_out" domain="['|', ('last_attendance_id', '=', False), ('last_attendance_id.check_out', '!=', False)]"/>
</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>