-
  I create a new lead.
-
  !record {model: crm.lead, id: test_crm_lead_new}:
    type: 'lead'
    name: 'Test lead new'
    partner_id: base.res_partner_1
    description: This is the description of the test new lead.
    team_id: sales_team.team_sales_department
-
  I check default stage of lead.
-
  !python {model: crm.lead}: |
    stage = self.pool.get('crm.stage').search_read(cr, uid, [('team_ids', '=', ref('sales_team.team_sales_department'))], ['id'], context=context)[0]
    lead = self.browse(cr, uid, ref('test_crm_lead_new'))
    assert lead.stage_id.id == stage['id'], "Default stage of lead is incorrect!"
-
  I change type from lead to opportunity.
-
  !python {model: crm.lead}: |
    self.convert_opportunity(cr, uid ,[ref("test_crm_lead_new")], ref("base.res_partner_2"))
-
  Now I change the stage of opportunity to won.
-
  !python {model: crm.lead}: |
    self.action_set_won(cr, uid, [ref("test_crm_lead_new")])
-
  I check statge of opp should won, after change stage.
-
  !python {model: crm.lead}: |
    opp = self.browse(cr, uid, ref('test_crm_lead_new'))
    stage_id = self.stage_find(cr, uid , [opp], opp.team_id.id or False,[('probability','=',100.0)], context)
    assert stage_id == opp.stage_id.id, "Stage of opportunity is incorrect!"

