Files
odoo_source/addons/hr_fleet/models/fleet_vehicle.py
T
jbm-odoo df44538a8b [IMP] fleet: Add analytic account and mobility card
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
2019-11-28 10:39:49 +00:00

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