[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#134156 X-original-commit: b82a338380e7e693d8123a496e36676260873828 Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com> Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
This commit is contained in:
@@ -62,7 +62,7 @@ class HRLeave(models.Model):
|
||||
if not leave.sudo().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
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user