From c656f53e81f7940bfd7cfc80d62d667ed5d57de0 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Mon, 17 Oct 2011 15:16:17 +0530 Subject: [PATCH] [ADD] crm: 1) Added yml partner2opportunity.yml, 2) Covered partner to opportunity scenario bzr revid: ron@tinyerp.com-20111017094617-9ctr8c7liedjo2fh --- addons/crm/__openerp__.py | 1 + .../crm/test/process/partner2opportunity.yml | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 addons/crm/test/process/partner2opportunity.yml diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index 9c45d9237b6..b1fdfd3ff62 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -121,6 +121,7 @@ Creates a dashboard for CRM that includes: 'test': [ 'test/process/lead_open.yml', 'test/process/lead2opportunity.yml', + 'test/process/partner2opportunity.yml', 'test/process/cancel_lead.yml', 'test/process/meeting.yml', 'test/process/lead2_mass_convert_opportunity.yml', diff --git a/addons/crm/test/process/partner2opportunity.yml b/addons/crm/test/process/partner2opportunity.yml new file mode 100644 index 00000000000..542056f0f9b --- /dev/null +++ b/addons/crm/test/process/partner2opportunity.yml @@ -0,0 +1,20 @@ +- | + I will create opportunity by partner. +- + !record {model: crm.partner2opportunity, id: crm_partner2opportunity_id_0}: + name: BalmerInc S.A. + planned_revenue: 200.0 + partner_id: base.res_partner_9 + probability: 150.0 + +- + Convert partner to opportunity, i will test to convert opportunity is correct. +- + !python {model: crm.partner2opportunity}: | + opportunity = self.make_opportunity(cr, uid, [ref("crm_partner2opportunity_id_0")]) + opportunity_rec = self.pool.get('crm.lead').browse(cr, uid, opportunity['res_id']) + assert opportunity_rec.type == 'opportunity', 'Lead is not converted to opportunity!' + assert opportunity_rec.planned_revenue == 200.0, 'Planned revenue should be 200!' + assert opportunity_rec.probability == 150.0, 'probability revenue should be 150!' + assert opportunity_rec.partner_id.id == ref("base.res_partner_9"), 'Partner missmatch!' + assert opportunity_rec.state == 'draft', 'Opportunity stage not in draft state'