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 20.0
Inputs Method Outputs
  • vehicle_id
  • vehicle_id.ids
  • vehicle_id.id
  • cost_subtype_id
  • cost_subtype_id.id
+ open_contracts = self.env['fleet.vehicle.log.contract'].search([
+             ('vehicle_id', 'in', self.vehicle_id.ids),
+             ('state', '=', 'open'),
+             ('expiration_date', '>=', 'today')
+         ])
+ open_contract_keys = {(c.vehicle_id.id, c.cost_subtype_id.id) for c in open_contracts}
+ for log_contract in self:
+             log_contract.has_open_contract = (log_contract.vehicle_id.id, log_contract.cost_subtype_id.id) in open_contract_keys
  • has_open_contract

Back to entity