Skip to content
Snippets Groups Projects
Commit 3d6d5138 authored by Thomas Lefebvre (thle)'s avatar Thomas Lefebvre (thle)
Browse files

[FIX] hr_holidays_attendance: correct date overtime attendances


Issue:
------
The `date` field of the `hr.attendance.overtime` model
records is not the date of the related leave.

Cause:
------
We use: `fields.Date.today()` instead of the leave field `date_from`.

Solution:
---------
Use `date_from` field of `leave`.

opw-3433480

closes odoo/odoo#134099

X-original-commit: b82a3383
Signed-off-by: default avatarSofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: default avatarThomas Lefebvre (thle) <thle@odoo.com>
parent 1f327405
Branches
Tags
No related merge requests found
......@@ -62,7 +62,7 @@ class HRLeave(models.Model):
if not leave.overtime_id:
leave.sudo().overtime_id = self.env['hr.attendance.overtime'].sudo().create({
'employee_id': employee.id,
'date': fields.Date.today(),
'date': leave.date_from,
'adjustment': True,
'duration': -1 * duration,
})
......@@ -79,7 +79,7 @@ class HRLeave(models.Model):
for leave in overtime_leaves:
overtime = self.env['hr.attendance.overtime'].sudo().create({
'employee_id': leave.employee_id.id,
'date': fields.Date.today(),
'date': leave.date_from,
'adjustment': True,
'duration': -1 * leave.number_of_hours_display
})
......
......@@ -42,7 +42,7 @@ class HolidaysAllocation(models.Model):
if not allocation.overtime_id:
allocation.sudo().overtime_id = self.env['hr.attendance.overtime'].sudo().create({
'employee_id': allocation.employee_id.id,
'date': fields.Date.today(),
'date': allocation.date_from,
'adjustment': True,
'duration': -1 * duration,
})
......@@ -72,7 +72,7 @@ class HolidaysAllocation(models.Model):
for allocation in overtime_allocations:
overtime = self.env['hr.attendance.overtime'].sudo().create({
'employee_id': allocation.employee_id.id,
'date': fields.Date.today(),
'date': allocation.date_from,
'adjustment': True,
'duration': -1 * allocation.number_of_hours_display
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment