From d30d7221bac5c044ac5cb99bf41c27a20915e96e Mon Sep 17 00:00:00 2001 From: "ajay javiya (OpenERP)" Date: Wed, 26 Jun 2013 12:24:33 +0530 Subject: [PATCH] [ADD]: test case fot stage find bzr revid: aja@tinyerp.com-20130626065433-9lwslnil10k3w8wv --- addons/crm/__openerp__.py | 1 + addons/crm/test/crm_lead_find_stage.yml | 43 +++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 addons/crm/test/crm_lead_find_stage.yml diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index e7ab7df27ea..3d29742ac9f 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -109,6 +109,7 @@ Dashboard for CRM will include: 'test/crm_lead_message.yml', 'test/lead2opportunity2win.yml', 'test/lead2opportunity_assign_salesmen.yml', + 'test/crm_lead_find_stage.yml', 'test/crm_lead_merge.yml', 'test/crm_lead_cancel.yml', 'test/segmentation.yml', diff --git a/addons/crm/test/crm_lead_find_stage.yml b/addons/crm/test/crm_lead_find_stage.yml new file mode 100644 index 00000000000..b8a11a4af9e --- /dev/null +++ b/addons/crm/test/crm_lead_find_stage.yml @@ -0,0 +1,43 @@ +- + 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: crm.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!" +