From d3843d7ed08808dbab592cb575a06ba72a49353e Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 26 Feb 2018 22:14:53 +0100 Subject: [PATCH] [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 --- addons/fleet/models/fleet_vehicle.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/fleet/models/fleet_vehicle.py b/addons/fleet/models/fleet_vehicle.py index 9cfde466c39..3d908148567 100644 --- a/addons/fleet/models/fleet_vehicle.py +++ b/addons/fleet/models/fleet_vehicle.py @@ -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