Untitled

mail@pastecode.io avatar
unknown
plain_text
24 days ago
992 B
3
Indexable
Never
checkout_time = self.env.company.checkout_time
            
if attendance.checkout_time and attendance.late_checkout_hrs:
            # Assuming attendance has a field `actual_checkout_time` storing the actual check-out time
            actual_checkout_time = attendance.actual_checkout_time
            
            # Calculate the late checkout time in hours
            late_checkout_diff = actual_checkout_time - attendance.checkout_time
            if late_checkout_diff > 0:
                attendance.late_checkout_hrs = late_checkout_diff
            else:
                attendance.late_checkout_hrs = 0.0
            
            # Convert late_checkout_hrs to display format HH:MM
            total_minutes = int(round(attendance.late_checkout_hrs * 60))
            hours = total_minutes // 60
            minutes = total_minutes % 60
            attendance.late_checkout_display = f'{hours:02d}:{minutes:02d}'
        else:
            attendance.late_checkout_display = '00:00'
Leave a Comment