← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/uco-dev-addons1 into lp:~openerp-dev/openobject-addons/trunk-dev-addons1

 

Ujjvala Collins (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/uco-dev-addons1 into lp:~openerp-dev/openobject-addons/trunk-dev-addons1.

Requested reviews:
  OpenERP R&D Team (openerp-dev)
Related bugs:
  #697443 Bug in the tree view of the projects, when grouping by parent
  https://bugs.launchpad.net/bugs/697443

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/uco-dev-addons1/+merge/45832

[ADD]
crm: Added a yaml to test for stage changes on lead/opportunity.
     (for lead opportunity : stage change, opening, closing, won, lost)
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/uco-dev-addons1/+merge/45832
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-dev/openobject-addons/uco-dev-addons1 into lp:~openerp-dev/openobject-addons/trunk-dev-addons1.
=== modified file 'crm/__openerp__.py'
--- crm/__openerp__.py	2011-01-06 10:56:32 +0000
+++ crm/__openerp__.py	2011-01-11 11:11:50 +0000
@@ -126,6 +126,7 @@
             'test/test_crm_opportunity.yml',
             'test/test_crm_phonecall.yml',
             'test/test_crm_recurrent_meeting.yml',
+            'test/test_crm_stage_changes.yml',
              ],
     'installable': True,
     'active': False,

=== added file 'crm/test/test_crm_stage_changes.yml'
--- crm/test/test_crm_stage_changes.yml	1970-01-01 00:00:00 +0000
+++ crm/test/test_crm_stage_changes.yml	2011-01-11 11:11:50 +0000
@@ -0,0 +1,90 @@
+-
+  In order to test the changes on stage of a lead or an opportunity with OpenERP,
+  I create some leads and test the stage changes.
+- 
+  I want to change the probability to 0.0 when the opportunity is marked as lost.
+  So I set its Change probability automatically true.
+- 
+  !record {model: crm.case.stage, id: crm.stage_opportunity6}:
+    name: Lost
+    on_change: true
+    probability: 0.0
+    section_ids:
+      - crm.section_sales_department
+    sequence: 0.0
+    type: opportunity
+- 
+  I create a lead 'OpenERP Presentation'.
+- 
+  !record {model: crm.lead, id: crm_lead_openerppresentation0}:
+    categ_id: crm.categ_oppor4
+    day_close: 0.0
+    day_open: 0.0
+    name: OpenERP Presentation
+    planned_revenue: 0.0
+    probability: 0.0
+    section_id: crm.section_sales_department
+-
+  I open the lead.
+-
+  !python {model: crm.lead}: |
+    self.case_open(cr, uid, [ref('crm_lead_openerppresentation0')])
+-
+  I find that this lead can be converted to opportunity. 
+-
+  !record {model: crm.lead2opportunity, id: crm_lead2opportunity0}:
+    name: OpenERP Presentation
+    probability: 60.0
+    planned_revenue: 45000.0
+-
+  So I convert the lead to opportunity.
+-
+  !python {model: crm.lead2opportunity}: |
+    self.action_apply(cr, uid, [ref('crm_lead2opportunity0')], context={'active_id': ref('crm_lead_openerppresentation0')})
+-
+  I check that lead is now converted to opportunity.
+-
+  !python {model: crm.lead}: |
+    lead = self.browse(cr, uid, ref('crm_lead_openerppresentation0'))
+    assert lead.type == 'opportunity', 'Lead is not converted to opportunity!'
+-
+  I mark this opportunity as lost.
+-
+  !python {model: crm.lead}: |
+    self.case_mark_lost(cr, uid, [ref('crm_lead_openerppresentation0')])
+-
+  Now I check whether the probability is set according to stage change or not.
+-
+  !python {model: crm.lead}: |
+    opportunity = self.browse(cr, uid, ref('crm_lead_openerppresentation0'))
+    assert opportunity.stage_id.id == ref('crm.stage_opportunity6'), 'Stage is not changed!'
+    assert opportunity.probability == 0.0, 'Probability is wrong!'
+-
+  I create one more opportunity.
+-
+  !record {model: crm.lead, id: crm_lead_partnerdemo0}:
+    categ_id: crm.categ_oppor3
+    day_close: 0.0
+    day_open: 0.0
+    name: Partner Demo
+    planned_revenue: 50000.0
+    probability: 70.0
+    section_id: crm.section_sales_department
+    type: opportunity
+-
+  I open this opportunity.
+-
+  !python {model: crm.lead}: |
+    self.case_open(cr, uid, [ref('crm_lead_partnerdemo0')])
+-
+  I mark this opportunity as won.
+-
+  !python {model: crm.lead}: |
+    self.case_close(cr, uid, [ref('crm_lead_partnerdemo0')])
+-
+  I check whether the stage is changed to 'Won' and probability is 100.0 or not.
+-
+  !python {model: crm.lead}: |
+    opportunity = self.browse(cr, uid, ref('crm_lead_partnerdemo0'))
+    assert opportunity.stage_id.id == ref('crm.stage_opportunity5'), 'Stage is not changed!'
+    assert opportunity.probability == 100.0, 'Probability is wrong!'


Follow ups