From 3ca7bb5d625df0fe4dd6a08a72ee20996ad4612b Mon Sep 17 00:00:00 2001 From: "ajay javiya (OpenERP)" Date: Tue, 25 Jun 2013 17:44:13 +0530 Subject: [PATCH] [IMP]: clean lead cancel yml bzr revid: aja@tinyerp.com-20130625121413-83rzmqxg1p1724uq --- addons/crm/__openerp__.py | 2 +- addons/crm/test/crm_lead_cancel.yml | 40 ++++++++--------------------- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index 21000f28720..e7ab7df27ea 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -110,7 +110,7 @@ Dashboard for CRM will include: 'test/lead2opportunity2win.yml', 'test/lead2opportunity_assign_salesmen.yml', 'test/crm_lead_merge.yml', -# 'test/crm_lead_cancel.yml', # TODO : Need To Clean + 'test/crm_lead_cancel.yml', 'test/segmentation.yml', 'test/phonecalls.yml', 'test/crm_lead_onchange.yml', diff --git a/addons/crm/test/crm_lead_cancel.yml b/addons/crm/test/crm_lead_cancel.yml index 8749675bf23..1efc4d8f1f6 100644 --- a/addons/crm/test/crm_lead_cancel.yml +++ b/addons/crm/test/crm_lead_cancel.yml @@ -1,40 +1,14 @@ - - I set a new sale team (with Marketing at parent) and I cancel unqualified lead . + I set a new sale team (with Marketing at parent) . - !python {model: crm.lead}: | section_id = self.pool.get('crm.case.section').create(cr, uid, {'name': "Phone Marketing", 'parent_id': ref("crm.crm_case_section_2")}) self.write(cr, uid, [ref("crm_case_1")], {'section_id': section_id}) - self.case_cancel(cr, uid, [ref("crm_case_1")]) - - I check cancelled lead. + I check unqualified lead . - - !python {model: crm.lead}: | - lead = self.browse(cr, uid, ref('crm_case_1')) - assert lead.stage_id.id == ref('crm.stage_lead7'), "Stage should be 'Dead' and is %s." % (lead.stage_id.name) - assert lead.state == 'cancel', "Opportunity is not in 'cancel' state." - assert lead.probability == 0.0, 'Opportunity is probably wrong and should be 0.0.' -- - I reset cancelled lead into unqualified lead. -- - !python {model: crm.lead}: | - self.case_reset(cr, uid, [ref("crm_case_1")]) -- - I check unqualified lead after reset. -- - !assert {model: crm.lead, id: crm.crm_case_1, string: Lead is in draft state}: - - state == "draft" -- - I re-open the lead -- - !python {model: crm.lead}: | - self.case_open(cr, uid, [ref("crm_case_1")]) -- - I check stage and state of the re-opened lead -- - !python {model: crm.lead}: | - lead = self.browse(cr, uid, ref('crm.crm_case_1')) - assert lead.stage_id.id == ref('crm.stage_lead2'), "Opportunity stage should be 'Qualification'." - assert lead.state == 'open', "Opportunity should be in 'open' state." + !assert {model: crm.lead, id: crm.crm_case_1, string: Lead is in new stage}: + - stage_id.sequence == 1 - I escalate the lead to parent team. - @@ -45,3 +19,9 @@ - !assert {model: crm.lead, id: crm.crm_case_1, string: Escalate lead to parent team}: - section_id.name == "Marketing" +- + I find default stage. +- + !python {model: crm.case.section}: | + case_section = self.browse(cr, uid, ref('section_sales_department')) + stage_id = self.stage_find(cr, uid, [lead], lead.section_id.id or False,[('probability','=',100.0)])