Files
odoo_source/addons/hr_work_entry_contract
alsh-odoo 15de3f7bf3 [FIX] hr_work_entry_contract: fix traceback when no contract for employee
This traceback arises when the user changes the date with a new employee
of no contract, while creating a new Work Entry.

To reproduce this issue:

Install "hr_work_entry_contract"
1) Open payroll and create a new "Work Entry"
2) Select Work Entry Type as Unpaid and create a new employee
3) Now try to change the date

Error:- 'KeyError: False'

On the '_get_duration_batch' method, when the user creates a new employee
without a contract, the calendar remains an empty recordset.

which leads to the traceback from the below lines.

https://github.com/odoo/odoo/blob/a277faa2ffab7559fcbad95fcc1e8fd6a26d756b/addons/hr_work_entry_contract/models/hr_work_entry.py#L110-L112

After applying this commit will resolve the issue by making code more robust and
give default value.

sentry-5095168051

closes odoo/odoo#159958

X-original-commit: dff6e723580162044d25e98e0394d28e00bab520
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2024-04-02 12:09:33 +00:00
..
…