[FIX] fleet: avoid function field computation order issues
The name of a vehicle is function field. The field odometer on a vehicle has a a setter that creates an odometer. The name of an odometer is a function field that uses the name of the vehicle. If a vehicle is created with a value in odometer field, the odometer is created before the name is computed so the concatanation would fail. Fixes #3468
This commit is contained in:
parent
e038fec696
commit
e826e84af5
|
@ -426,8 +426,10 @@ class fleet_vehicle_odometer(osv.Model):
|
|||
res = {}
|
||||
for record in self.browse(cr, uid, ids, context=context):
|
||||
name = record.vehicle_id.name
|
||||
if record.date:
|
||||
name = name+ ' / '+ str(record.date)
|
||||
if not name:
|
||||
name = record.date
|
||||
elif record.date:
|
||||
name += ' / '+ record.date
|
||||
res[record.id] = name
|
||||
return res
|
||||
|
||||
|
|
Loading…
Reference in New Issue