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

Inputs Method Outputs
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

Back to entity