[IMP] fleet: Display all the stages on the fleet.vehicle kanban view

All the stage should be displayed to allow a user to move a car in another stage
even if no other cars are into it.
This commit is contained in:
Yannick Tivisse
2018-04-27 17:30:29 +02:00
parent b510e7f41b
commit 2bc85571a9
2 changed files with 7 additions and 1 deletions
+6 -1
View File
@@ -35,7 +35,8 @@ class FleetVehicle(models.Model):
acquisition_date = fields.Date('Immatriculation Date', required=False,
default=fields.Date.today, help='Date when the vehicle has been immatriculated')
color = fields.Char(help='Color of the vehicle')
state_id = fields.Many2one('fleet.vehicle.state', 'State', default=_get_default_state,
state_id = fields.Many2one('fleet.vehicle.state', 'State',
default=_get_default_state, group_expand='_read_group_stage_ids',
help='Current state of the vehicle', ondelete="set null")
location = fields.Char(help='Location of the vehicle (garage, ...)')
seats = fields.Integer('Seats Number', help='Number of seats of the vehicle')
@@ -223,6 +224,10 @@ class FleetVehicle(models.Model):
return super(FleetVehicle, self).write(vals)
@api.model
def _read_group_stage_ids(self, stages, domain, order):
return self.env['fleet.vehicle.state'].search([], order=order)
@api.multi
def return_action_to_open(self):
""" This opens the xml view specified in xml_id for the current vehicle """
@@ -227,6 +227,7 @@
<field name="res_model">fleet.vehicle</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{'search_default_groupby_status': 1}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new vehicle