diff --git a/fieldservice/models/fsm_stage.py b/fieldservice/models/fsm_stage.py index fb3d3b9bde..4a7b48b7d0 100644 --- a/fieldservice/models/fsm_stage.py +++ b/fieldservice/models/fsm_stage.py @@ -45,8 +45,7 @@ def _default_team_ids(self): stage_type = fields.Selection([('order', 'Order'), ('equipment', 'Equipment'), ('location', 'Location'), - ('worker', 'Worker')], 'Type', - required=True) + ('worker', 'Worker')], 'Type', require=True) company_id = fields.Many2one( 'res.company', string='Company', default=lambda self: self.env.user.company_id.id) @@ -73,8 +72,8 @@ def get_color_information(self): def create(self, vals): stages = self.env['fsm.stage'].search([]) for stage in stages: - if stage.stage_type == vals['stage_type'] and \ - stage.sequence == vals['sequence']: + if stage.stage_type == vals.get('stage_type') and \ + stage.sequence == vals.get('sequence'): raise ValidationError(_("Cannot create FSM Stage because " "it has the same Type and Sequence " "of an existing FSM Stage.")) diff --git a/fieldservice/views/fsm_team.xml b/fieldservice/views/fsm_team.xml index 6555d40513..43d4729625 100644 --- a/fieldservice/views/fsm_team.xml +++ b/fieldservice/views/fsm_team.xml @@ -13,7 +13,8 @@ Orders fsm.order kanban,timeline,tree,form,calendar - {'default_team_id': active_id} + {'default_team_id': active_id, + 'default_stage_type':'order'} [('team_id', '=', active_id)]