-
  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.
    section_id: sales_team.section_sales_department
-
  I check default stage of lead.
-
  !python {model: crm.lead}: |
    stage = self.pool.get('crm.case.stage').search_read(cr,uid,[('sequence','=',1)],['id'],context)[0]
    lead = self.browse(cr, uid, ref('test_crm_lead_new'))
    stage_id = self.stage_find(cr, uid , [lead], lead.section_id.id or False,[], context)
    assert stage_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 check default stage after change type.
-
  !python {model: crm.lead}: |
    stage = self.pool.get('crm.case.stage').search_read(cr,uid,[('sequence','=',1)],['id'],context)[0]
    opp = self.browse(cr, uid, ref('test_crm_lead_new'))
    stage_id = self.stage_find(cr, uid , [opp], opp.section_id.id or False,[], context)
    assert stage_id == stage['id'], "Default stage of opportunity is incorrect!"
-
  Now I change the stage of opportunity to won.
-
  !python {model: crm.lead}: |
    self.case_mark_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.section_id.id or False,[('probability','=',100.0)], context)
    assert stage_id == opp.stage_id.id, "Stage of opportunity is incorrect!"

