openerp - How to know the last attendance action of the current user ('sign_in' or 'sign_out') in odoo 9? -
i have extended hr_attendance module , want last value of 'action' of current logged user (it can 'sign_in' or 'sign_out')
i don't know how access value.
in attendance module there these functions:
def _altern_si_so(self, cr, uid, ids, context=none): ... def _state(self, cr, uid, ids, name, args, context=none) ...
but don't know how call functions inside extended module or if there way value.
looking database tables found solution:
first obtain employee_id associated logged user
employee_id = {} cr.execute('select hr.id \ resource_resource res join hr_employee hr \ on res.id = hr.resource_id \ res.user_id = %s',[uid]) res in cr.fetchall(): employee_id = res[0]
then, last action of employee_id
last_action = {} cr.execute('select hr_attendance.action \ hr_attendance \ employee_id = %s',[employee_id]) res in cr.fetchall(): last_action = res[0]
'last_action' has "sign_in" or "sign_out" (the last action done current user in attendance module)
Comments
Post a Comment