[FIX] hr_work_entry_contract: fix first batching

While investigating an error that occured on production it was noticed
that work entry batching did not happen correctly on the first batch for
contracts that started on the same date, this is due to the microseconds
being different in the `date_generated_from` and `date_generated_to`
fields.

TaskId-2466871
This commit is contained in:
William Braeckman
2022-05-10 14:56:10 +02:00
parent 5bf898d58a
commit 3b1e37ce67
@@ -19,9 +19,10 @@ class HrContract(models.Model):
_description = 'Employee Contract'
date_generated_from = fields.Datetime(string='Generated From', readonly=True, required=True,
default=lambda self: datetime.now().replace(hour=0, minute=0, second=0), copy=False)
default=lambda self: datetime.now().replace(hour=0, minute=0, second=0, microsecond=0), copy=False)
date_generated_to = fields.Datetime(string='Generated To', readonly=True, required=True,
default=lambda self: datetime.now().replace(hour=0, minute=0, second=0), copy=False)
default=lambda self: datetime.now().replace(hour=0, minute=0, second=0, microsecond=0), copy=False)
def _get_default_work_entry_type(self):
return self.env.ref('hr_work_entry.work_entry_type_attendance', raise_if_not_found=False)