# -*- coding: utf-8 -*-
###############################################################################
#
#    Tech-Receptives Solutions Pvt. Ltd.
#    Copyright (C) 2009-TODAY Tech-Receptives(<http://www.techreceptives.com>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Lesser General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Lesser General Public License for more details.
#
#    You should have received a copy of the GNU Lesser General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################

from odoo import api, fields, models, tools, _
from odoo.modules import get_module_resource
from odoo.osv.expression import get_unaccent_wrapper
from odoo.exceptions import UserError, ValidationError

class FleetVehicleType(models.Model):
    _name = 'fleet.vehicle.type'
    _description = 'Types of Vehicle'

    name = fields.Char(string="Name", required=True)
    code = fields.Char(string="Code", required=True)

class FleetVehicle(models.Model):
    _inherit = ['fleet.vehicle']

    vehicle_type = fields.Selection(related='model_id.vehicle_type',string="Model Type")
    vehicle_type_id = fields.Many2one('fleet.vehicle.type', 'Type of Vehicle', index=True)
    chassis_number = fields.Char(string="Chassis Number")

class FleetVehicleOdometer(models.Model):
    _inherit = 'fleet.vehicle.odometer'

    date = fields.Datetime(default=fields.Datetime.now())
