[FIX] fleet: expired contract
- Create a contract for a vehicle - Renew the contract and set old one to closed - Run the cron 'Fleet: Generate contracts costs based on costs frequency' The closed contract is reset to expired. The contract should remain closed. opw-1949470 closes odoo/odoo#31974 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -274,7 +274,7 @@ class FleetVehicleLogContract(models.Model):
|
||||
Vehicle.browse(vehicle).message_post(body=_('%s contract(s) will expire soon and should be renewed and/or closed!') % value)
|
||||
nearly_expired_contracts.write({'state': 'diesoon'})
|
||||
|
||||
expired_contracts = self.search([('state', '!=', 'expired'), ('expiration_date', '<',fields.Date.today() )])
|
||||
expired_contracts = self.search([('state', 'not in', ['expired', 'closed']), ('expiration_date', '<',fields.Date.today() )])
|
||||
expired_contracts.write({'state': 'expired'})
|
||||
|
||||
futur_contracts = self.search([('state', 'not in', ['futur', 'closed']), ('start_date', '>', fields.Date.today())])
|
||||
|
||||
Reference in New Issue
Block a user