-
- Downloads
[FIX] hr_work_entry_contract: work entry timezone issue for attendance
Steps to reproduce: - Install Attendances app and Employee app - Setup an employee with a contract which work entry source is from attendance - Change the working schedule to different timezone, for example Asia/Hong_Kong - By default the working schedule should be start to work from 0800 to 1700 - Now create an attendance in the first day of the contract, i.e. 1st May 2023, check in time 0700, check out time 2000 - The total work hours should be 13 - However, in the work entry, the genearted work entry is 0800-2000, only 12 work hours. Current behaviour: The generated work entry mismatches the value of the attendance Expected behaviour: The work entry should match the attendance Explanation: This issue is casued by the timezone issue. When the system generate the work entry, it will calculate the date_from datetime and date_to datetime. Then it will compare between the attendance and the date_from datetime to choose the larger datetime to put inside the work entry as start time. However, the date_from datetime didn't consider the timezone of the working schedule. In the above example, Asia/Hong Kong time is UTC+8 time. Therefore if we convert the attendance time back to UTC time. It is check in time 30 April 2023, 2300 to check out time 1 May 2023, 1200. In the mean time, if we compare between the date_from datetime (1 May 2023, 0000) and the attendance check in time (30 April 2023, 2300). The system will take the date_from time and therefore the generated work entry time is incorrect. task-3468012 closes odoo/odoo#133610 Related: odoo/enterprise#46574 Signed-off-by:Xavier Bol (xbo) <xbo@odoo.com> Co-authored-by:
Yannick Tivisse <yti@odoo.com>
Showing
- addons/hr_work_entry_contract/models/hr_contract.py 44 additions, 9 deletionsaddons/hr_work_entry_contract/models/hr_contract.py
- addons/hr_work_entry_contract/models/hr_employee.py 1 addition, 11 deletionsaddons/hr_work_entry_contract/models/hr_employee.py
- addons/hr_work_entry_contract/tests/test_global_time_off.py 3 additions, 3 deletionsaddons/hr_work_entry_contract/tests/test_global_time_off.py
- addons/hr_work_entry_contract/tests/test_work_entry.py 36 additions, 0 deletionsaddons/hr_work_entry_contract/tests/test_work_entry.py
- addons/hr_work_entry_holidays/tests/test_leave.py 4 additions, 4 deletionsaddons/hr_work_entry_holidays/tests/test_leave.py
- addons/hr_work_entry_holidays/tests/test_multi_contract.py 3 additions, 3 deletionsaddons/hr_work_entry_holidays/tests/test_multi_contract.py
- addons/hr_work_entry_holidays/tests/test_payslip_holidays_computation.py 1 addition, 1 deletion...entry_holidays/tests/test_payslip_holidays_computation.py
- addons/hr_work_entry_holidays/tests/test_performance.py 1 addition, 1 deletionaddons/hr_work_entry_holidays/tests/test_performance.py
- addons/hr_work_entry_holidays/tests/test_work_entry.py 2 additions, 2 deletionsaddons/hr_work_entry_holidays/tests/test_work_entry.py
Loading
Please register or sign in to comment