[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:
Martin Trigaux 2014-11-13 16:02:11 +01:00
parent e038fec696
commit e826e84af5
1 changed files with 4 additions and 2 deletions

View File

@ -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