Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4783 Widoki

Hi everybody, 

I am working on a new module to round time hours to 1:00 1:15 1:30 etc...

This module is based on hr_attendance check_in end check_out times...


if attendance.check_out:
delta = datetime.strptime(attendance.check_out, DEFAULT_SERVER_DATETIME_FORMAT) - datetime.strptime(attendance.check_in, DEFAULT_SERVER_DATETIME_FORMAT)
roundTo = float(900)
rounding = (delta + roundTo / 2) // roundTo * roundTo
attendance.worked_hours = strftime('%H:%M', gmtime(rounding))


File "c:\program files (x86)\odoo v11\server\odoo\addons\3e_heures_CAPEB\models\models.py", line 46, in _compute_worked_hours
    rounding = (delta + roundTo / 2) // roundTo * roundTo
TypeError: unsupported operand type(s) for +: 'datetime.timedelta' and 'float'
Thanks for your help...


Awatar
Odrzuć
Najlepsza odpowiedź

Did you manage to make this work? I'm looking for a solution to have rounding in the Attendance module or a module that works the same

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
3
wrz 22
7256
3
mar 21
2080
5
lut 20
12095
2
lut 19
2831
0
lut 19
3926