Create analytic account from fleet (and link it to vehicle) based on the plate and the fiscal deduction rate (if l10n_hr_payroll_fleet is installed). Add on employee a Mobility Card number. This number is set on vehicle when we put a partner linked to employee on a vehicle. taskID: 2127641
16 lines
473 B
Python
16 lines
473 B
Python
# -*- coding:utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class FleetVehicle(models.Model):
|
|
_inherit = 'fleet.vehicle'
|
|
|
|
mobility_card = fields.Char(compute='_compute_mobility_card', store=True)
|
|
|
|
@api.depends('driver_id')
|
|
def _compute_mobility_card(self):
|
|
for vehicle in self:
|
|
vehicle.mobility_card = vehicle.driver_id.user_ids[:1].employee_id.mobility_card
|