Skip to content

Commit

Permalink
[12.0][FIX] Improved code of stage create method.
Browse files Browse the repository at this point in the history
  • Loading branch information
rutul-serpentcs committed Oct 6, 2020
1 parent 34ed40d commit b21997b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions fieldservice/models/fsm_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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."))
Expand Down
3 changes: 2 additions & 1 deletion fieldservice/views/fsm_team.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<field name="name">Orders</field>
<field name="res_model">fsm.order</field>
<field name="view_mode">kanban,timeline,tree,form,calendar</field>
<field name="context">{'default_team_id': active_id}</field>
<field name="context">{'default_team_id': active_id,
'default_stage_type':'order'}</field>
<field name="domain">[('team_id', '=', active_id)]</field>
</record>

Expand Down

0 comments on commit b21997b

Please sign in to comment.