[IMP] fleet: Close driver history on driver change
Purpose ======= If you set a future driver and click on "apply change", a new assignation log is automatically created for the new driver. But the end date of the former assignation isn't populate. Specifications ============== Set the date "end date" for the former driver with the "start date" of the new driver. closes odoo/odoo#44635 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
@@ -238,6 +238,7 @@ class FleetVehicle(models.Model):
|
||||
})
|
||||
|
||||
def action_accept_driver_change(self):
|
||||
self._close_driver_history()
|
||||
# Find all the vehicles for which the driver is the future_driver_id
|
||||
# remove their driver_id and close their history using current date
|
||||
vehicles = self.search([('driver_id', 'in', self.mapped('future_driver_id').ids)])
|
||||
|
||||
Reference in New Issue
Block a user