[FIX] hr_contract: do not close contracts a day early
Steps to reproduce: Launch a contract which has an end date scheduled for the next day for an employee and manually activate the "HR Contract: update state" cron. Issue: Running contracts are closed one day in advance. Solution: Correct the condition which selects contracts to close. opw-3217616 closes odoo/odoo#116580 X-original-commit: e08aa67009b191cb99dfb1f7f1d0cb9d6539376a Signed-off-by: Kevin Baptiste <kba@odoo.com> Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
This commit is contained in:
@@ -185,8 +185,8 @@ class Contract(models.Model):
|
||||
contracts_to_close = self.search([
|
||||
('state', '=', 'open'),
|
||||
'|',
|
||||
('date_end', '<=', fields.Date.to_string(date.today() + relativedelta(days=1))),
|
||||
('visa_expire', '<=', fields.Date.to_string(date.today() + relativedelta(days=1))),
|
||||
('date_end', '<=', fields.Date.to_string(date.today())),
|
||||
('visa_expire', '<=', fields.Date.to_string(date.today())),
|
||||
])
|
||||
|
||||
if contracts_to_close:
|
||||
|
||||
Reference in New Issue
Block a user