From 570e6ea1bd817536a0f82293d8f2c86fdf4ba478 Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Wed, 7 Sep 2011 18:31:53 +0530 Subject: [PATCH] [IMP]crm : Improve the test cases bzr revid: dbr@tinyerp.com-20110907130153-x0giuqans4nq00l8 --- addons/crm/test/test_crm_lead.yml | 64 ++++++++----------- addons/crm/test/test_crm_lead_case2.yml | 8 +++ .../crm/test/test_crm_partner2opportunity.yml | 9 ++- addons/crm/test/test_crm_phonecall.yml | 25 ++++++++ addons/crm/test/test_crm_segmentation.yml | 2 + 5 files changed, 70 insertions(+), 38 deletions(-) diff --git a/addons/crm/test/test_crm_lead.yml b/addons/crm/test/test_crm_lead.yml index 002d57a994a..42b39699c62 100644 --- a/addons/crm/test/test_crm_lead.yml +++ b/addons/crm/test/test_crm_lead.yml @@ -86,6 +86,30 @@ - !python {model: crm.lead2opportunity.partner}: | self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_create_0")], {'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")}) +- + | + Now, select "Link to an existing partner" option in this wizard. +- + !record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_create_1}: + action: 'exist' + name: 'existing partner' +- + Then, Click on "Create Opportunity" button of this wizard. +- + !python {model: crm.lead2opportunity.partner}: | + self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_create_1")], {'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")}) +- + | + Now, select "Do not link to a partner" option in this wizard. +- + !record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_create_2}: + action: 'nothing' + name: 'Do not link to a partner' +- + Then, Click on "Create Opportunity" button of this wizard. +- + !python {model: crm.lead2opportunity.partner}: | + self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_create_2")], {'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")}) - | In order to check the opportunity is created or not, I check type. - @@ -93,47 +117,13 @@ lead = self.browse(cr, uid, ref("crm_lead_newcustomer0")) assert lead.type == 'opportunity' -- - Convert lead2opportunity partner record -- - !record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_convert0}: - action: exist - name: convert -- - Then, Click on "Create Opportunity" button of this wizard. -- - !python {model: crm.lead2opportunity.partner}: | - self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_convert0")]) -- - Creating a partner wih merge Option -- - !record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_merge0}: - action: create - name: merge -- - Then, Click on "Create Opportunity" button of this wizard. -- - !python {model: crm.lead2opportunity.partner}: | - fields={} - self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_merge0")]) -- - Creating a crm.lead2opportunity.partner record with existing -- - !record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_convert0}: - action: exist - name: convert - partner_id: base.res_partner_desertic_hispafuentes -- - Then, Click on "Create Opportunity" button of this wizard. -- - !python {model: crm.lead2opportunity.partner}: | - self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_convert0")]) - - Creating crm.lead2opportunity.partner.mass report - !record {model: crm.lead2opportunity.partner.mass, id: crm_lead2opportunity_partner_mass0}: - {} + user_ids: + - base.user_root + section_id: crm.section_sales_department - Then, execute lead2opportunity.partner.mass wizard. - diff --git a/addons/crm/test/test_crm_lead_case2.yml b/addons/crm/test/test_crm_lead_case2.yml index fb83967efd8..90092abf1c2 100644 --- a/addons/crm/test/test_crm_lead_case2.yml +++ b/addons/crm/test/test_crm_lead_case2.yml @@ -22,6 +22,8 @@ working_hours: 0.0 resource_calendar_id: resource.timesheet_group1 parent_id: crm.section_sales_department +- + I assign segmentation. - !record {model: res.users, id: res_users_usercrm0}: context_section_id: crm_case_section_demosalesteam @@ -43,6 +45,12 @@ - !assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in Draft}: - state == "draft" +- + I create categories. +- + !record {model: crm.case.categ, id: crm_case_categ0}: + name: crm_case_section_demosalesteam + section_id: crm_case_section_demosalesteam - I assigning contact detail to the Lead "Demo Customer" without address. - diff --git a/addons/crm/test/test_crm_partner2opportunity.yml b/addons/crm/test/test_crm_partner2opportunity.yml index 765fbd2d9e2..ea546e7bf8e 100644 --- a/addons/crm/test/test_crm_partner2opportunity.yml +++ b/addons/crm/test/test_crm_partner2opportunity.yml @@ -4,12 +4,19 @@ !record {model: crm.partner2opportunity, id: crm_partner2opportunity_id_0}: name: test planned_revenue: 0.0 + partner_id: base.res_partner_9 probability: 0.0 - Now, click on "Create Opportunity" button of this wizard. - !python {model: crm.partner2opportunity}: | - self.default_get(cr, uid, [ref("crm_partner2opportunity_id_0")], {"active_ids": [ref("crm_partner2opportunity_id_0")]}) + fields = { + 'name': 'test', + 'planned_revenue': '0.0', + 'partner_id': ref('base.res_partner_9'), + 'probability': '0.0' + } + self.default_get(cr, uid, fields, {"active_ids": [ref("crm_partner2opportunity_id_0")]}) - | In order to check the opportunity is created or not, I check type. - diff --git a/addons/crm/test/test_crm_phonecall.yml b/addons/crm/test/test_crm_phonecall.yml index 8becbbf493e..794878e5fd6 100644 --- a/addons/crm/test/test_crm_phonecall.yml +++ b/addons/crm/test/test_crm_phonecall.yml @@ -17,6 +17,7 @@ Now, click on "Continue" button of this wizard. - !python {model: crm.phonecall2partner}: | + self._select_partner(cr, uid,{"active_ids": [ref("crm_phonecall_interviewcall0")]}) self.open_create_partner(cr, uid, [ref("crm_phonecall2partner_1")], {"active_ids": [ref("crm_phonecall_interviewcall0")]}) self.make_partner(cr, uid, [ref("crm_phonecall2partner_1")], {"active_ids": [ref("crm_phonecall_interviewcall0")]}) @@ -49,6 +50,7 @@ !python {model: crm.phonecall}: | obj_phonecall = self.browse(cr, uid, ref('crm_phonecall_interviewcall0')) ids = self.pool.get('crm.lead').search(cr, uid, [('name', '=', obj_phonecall.opportunity_id.name)]) + #self.case_reset(cr, uid, ids) obj_opp = self.pool.get('crm.lead').browse(cr, uid, ids)[0] assert obj_phonecall.partner_id == obj_opp.partner_id @@ -87,9 +89,32 @@ name: Interview call section_id: crm.section_sales_department user_id: base.user_root + action: schedule + categ_id: crm.categ_phone1 +- + I click on "schedule other call" button. and plan for other call. +- + !record {model: crm.phonecall2phonecall, id: crm_phonecall2phonecall_interviewcall1}: + date: !eval "'%s-%s-%s 19:49:00' %(datetime.now().year,datetime.now().month,datetime.now().day)" + name: Interview call + section_id: crm.section_sales_department + user_id: base.user_root + action: log categ_id: crm.categ_phone1 - | I click on "Schedule" button of this wizard. - !python {model: crm.phonecall2phonecall}: | + fields = { + 'name': 'Interview call', + 'section_id': ref('crm.section_sales_department'), + 'user_id': ref('base.user_root'), + 'categ_id': ref('crm.categ_phone1') + } + self.default_get(cr, uid, fields,{'active_id': ref('crm_phonecall_interviewcall0')}) self.action_apply(cr, uid, [ref('crm_phonecall2phonecall_interviewcall0')], {'active_id': ref('crm_phonecall_interviewcall0')}) +- | + I click on "Schedule" button of this wizard with log option. +- + !python {model: crm.phonecall2phonecall}: | + self.action_apply(cr, uid, [ref('crm_phonecall2phonecall_interviewcall1')], {'active_id': ref('crm_phonecall_interviewcall0')}) diff --git a/addons/crm/test/test_crm_segmentation.yml b/addons/crm/test/test_crm_segmentation.yml index 1d308aba13f..b2159065317 100644 --- a/addons/crm/test/test_crm_segmentation.yml +++ b/addons/crm/test/test_crm_segmentation.yml @@ -8,6 +8,7 @@ exclusif: true name: segment som_interval: 0.0 + sales_purchase_active : True - Now, Start the process, - @@ -29,6 +30,7 @@ name: Rule1 operator: or segmentation_id: crm_segmentation_id_0 + - Checking the Segmentation line record. -