[FIX]fleet: Error when clicking on the costs of a vehicule

Steps to reproduce the bug:

- Go to Fleet
- Group by status
- Click on a vehicule
- Click on Costs

Bug: A traceback was raised because a group_by was made on the model "fleet.vehicle.cost"
for the field "state_id" and this field doesn't exist on this model.

opw:1815454
This commit is contained in:
Goffin Simon
2018-02-27 09:42:40 +01:00
parent 03645bc51f
commit d3843d7ed0
+3 -1
View File
@@ -247,9 +247,11 @@ class FleetVehicle(models.Model):
@return: the costs log view
"""
self.ensure_one()
copy_context = dict(self.env.context)
copy_context.pop('group_by', None)
res = self.env['ir.actions.act_window'].for_xml_id('fleet', 'fleet_vehicle_costs_action')
res.update(
context=dict(self.env.context, default_vehicle_id=self.id, search_default_parent_false=True),
context=dict(copy_context, default_vehicle_id=self.id, search_default_parent_false=True),
domain=[('vehicle_id', '=', self.id)]
)
return res