[IMP]crm : Improve the test cases
authorDBR (OpenERP) <dbr@tinyerp.com>
Wed, 7 Sep 2011 13:01:53 +0000 (18:31 +0530)
committerDBR (OpenERP) <dbr@tinyerp.com>
Wed, 7 Sep 2011 13:01:53 +0000 (18:31 +0530)
bzr revid: dbr@tinyerp.com-20110907130153-x0giuqans4nq00l8

addons/crm/test/test_crm_lead.yml
addons/crm/test/test_crm_lead_case2.yml
addons/crm/test/test_crm_partner2opportunity.yml
addons/crm/test/test_crm_phonecall.yml
addons/crm/test/test_crm_segmentation.yml

index 002d57a..42b3969 100644 (file)
 -
    !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")})
--  |
-   In order to check the opportunity is created or not, I check type.
--
-  !python {model: crm.lead}: |
-    lead = self.browse(cr, uid, ref("crm_lead_newcustomer0"))
-    assert lead.type == 'opportunity'
-
 -
-  Convert lead2opportunity partner record
+   |
+   Now, select "Link to an existing partner" option in this wizard.
 -
-  !record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_convert0}:
-    action: exist
-    name: convert
+   !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_convert0")])
+      self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_create_1")], {'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")})
 -
-  Creating a partner wih merge Option
+   |
+   Now, select "Do not link to a partner" option in this wizard.
 -
-  !record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_merge0}:
-    action: create
-    name: merge
+   !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}: |
-      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.
+      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.
 -
-   !python {model: crm.lead2opportunity.partner}: |
-      self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_convert0")])
+  !python {model: crm.lead}: |
+    lead = self.browse(cr, uid, ref("crm_lead_newcustomer0"))
+    assert lead.type == 'opportunity'
 
 -
   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.
 -
index fb83967..90092ab 100644 (file)
@@ -23,6 +23,8 @@
     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    
 -  |
    !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.
 -
   !python {model: crm.lead}: |
index 765fbd2..ea546e7 100644 (file)
@@ -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.
 -
index 8becbbf..794878e 100644 (file)
@@ -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
 
     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')})
index 1d308ab..b215906 100644 (file)
@@ -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.
 -