Thanks Jignesh,
Your solution solved my issue. I found one more solution.
def _get_vehicles(self, cr, uid, ids, fields, arg, context=None):
res = {}
#vehicle = self.env['fleet.vehicle']
for _obj in self.browse(cr, uid, ids, context=context):
#('vehicle_id','=', self.vehicle_id)
_orders = self.pool.get('fleet.vehicle.log.contract').search(cr, uid, [('vehicle_id','=',context.get('active_id', False))], context=context)
res[_obj.id] =_orders
return res
'vehicle_ids' : fields.function(_get_vehicles, string="Vehicles", type="many2many", relation='fleet.vehicle'),
<field name="vehicle_ids" nolabel="1" >
But loop is getting all the contracts not for a particular vehicle. Can you tell me, what I am missing?