[FIX] project_timesheet_holidays: fix traceback when approving a time off with several employees
Description of the issue/feature this PR addresses: A traceback appears when a time off is at the second approval stage and approved with several employees assigned to the time off. https://www.awesomescreenshot.com/video/5408638 Current behavior before PR: When validating a time off that is in the second approval stage with several employees assigned to, a traceback appears Desired behavior after PR is merged: No traceback appears when validating a time off that is in the second approval stage with several employees assigned to task-2657656 closes odoo/odoo#77625 X-original-commit: aaa7c5bf10089eb8953f46cccb2e93aa3a20fa35 Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
@@ -75,12 +75,13 @@ class Holidays(models.Model):
|
||||
def _timesheet_create_lines(self):
|
||||
self.ensure_one()
|
||||
vals_list = []
|
||||
work_hours_data = self.employee_id.list_work_time_per_day(
|
||||
self.date_from,
|
||||
self.date_to,
|
||||
)
|
||||
for index, (day_date, work_hours_count) in enumerate(work_hours_data):
|
||||
vals_list.append(self._timesheet_prepare_line_values(index, work_hours_data, day_date, work_hours_count))
|
||||
if self.employee_id:
|
||||
work_hours_data = self.employee_id.list_work_time_per_day(
|
||||
self.date_from,
|
||||
self.date_to,
|
||||
)
|
||||
for index, (day_date, work_hours_count) in enumerate(work_hours_data):
|
||||
vals_list.append(self._timesheet_prepare_line_values(index, work_hours_data, day_date, work_hours_count))
|
||||
timesheets = self.env['account.analytic.line'].sudo().create(vals_list)
|
||||
return timesheets
|
||||
|
||||
|
||||
Reference in New Issue
Block a user