diff options
| author | Prakash Prajapati <ppr@odoo.com> | 2017-10-19 14:24:58 +0200 |
|---|---|---|
| committer | Richard Mathot <rim@odoo.com> | 2017-10-20 09:50:06 +0200 |
| commit | 2e038cc6bd50fdf51eaa3e3788feb524145cf36d (patch) | |
| tree | 30b55bb1e84a222be0df1e171ac93fc8c5bc7fd3 | |
| parent | a25d604305689e52ee279ffd69d05f2d142deaee (diff) | |
[IMP] hr_attendance: allow to search for "signed in/out" employees
| -rw-r--r-- | addons/hr_attendance/models/hr_employee.py | 2 | ||||
| -rw-r--r-- | addons/hr_attendance/views/hr_employee_view.xml | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/addons/hr_attendance/models/hr_employee.py b/addons/hr_attendance/models/hr_employee.py index 7e224328003..7eab0eedf64 100644 --- a/addons/hr_attendance/models/hr_employee.py +++ b/addons/hr_attendance/models/hr_employee.py @@ -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') diff --git a/addons/hr_attendance/views/hr_employee_view.xml b/addons/hr_attendance/views/hr_employee_view.xml index b187f370f60..4c96bfe13d5 100644 --- a/addons/hr_attendance/views/hr_employee_view.xml +++ b/addons/hr_attendance/views/hr_employee_view.xml @@ -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> |
