Hello, I am using odoo 13.
Employees in the system can check-in and check out multiple times per day. I want to get the first check and the last check out for a specific employee every day.
this is is my code for the first check in, but it got first check-in not for specific day but for the whole time
def get_first_check_in_time(self):
first_sign_in = ''
for emp in self:
attn_ids = self.env['hr.attendance'].search([('employee_id', '=', emp.id)])
if attn_ids:
for a in attn_ids:
if not emp.first_sign_in:
emp.first_sign_in = a.check_in
else:
first_sign_in = min(emp.first_sign_in, a.check_in)
emp.first_sign_in = first_sign_in
else:
emp.first_sign_in = False