Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Fleet

Entity: fleet.vehicle.log.contract

Compute Method: _compute_has_open_contract

View 19.0
Inputs Method Outputs
  • vehicle_id
  • vehicle_id.ids
+ today = fields.Date.today()
+ open_contracts = self.env['fleet.vehicle.log.contract'].search([
+             ('vehicle_id', 'in', self.vehicle_id.ids),
+             ('state', '=', 'open'),
+             ('expiration_date', '>=', today)
+         ])
+ for log_contract in self:
+             log_contract.has_open_contract = log_contract.vehicle_id in open_contracts.vehicle_id
  • has_open_contract

Back to entity