Steps to reproduce the bug: - Let's consider a partner P linked to an employee E and a vehicle V - Let's change the mobility card of E with 12345 Bug: The mobility card on V was not changed. opw:2431316 closes odoo/odoo#64343 X-original-commit: 81e574aae3059844179dd9f54a241cd51a2474fd Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
16 lines
521 B
Python
16 lines
521 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', 'driver_id.user_ids.employee_id.mobility_card')
|
|
def _compute_mobility_card(self):
|
|
for vehicle in self:
|
|
vehicle.mobility_card = vehicle.driver_id.user_ids[:1].employee_id.mobility_card
|