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

Proposed by Ujjvala Collins
Status: Merged
Merged at revision: 4672
Proposed branch: lp:~openerp-dev/openobject-addons/uco-dev-addons1
Merge into: lp:~openerp-dev/openobject-addons/trunk-dev-addons1
Diff against target: 106 lines (+91/-0)
2 files modified
crm/__openerp__.py (+1/-0)
crm/test/test_crm_stage_changes.yml (+90/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/uco-dev-addons1
Reviewer Review Type Date Requested Status
OpenERP R&D Team Pending
Review via email: mp+45832@code.launchpad.net

Description of the change

[ADD]
crm: Added a yaml to test for stage changes on lead/opportunity.
     (for lead opportunity : stage change, opening, closing, won, lost)

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'crm/__openerp__.py'
2--- crm/__openerp__.py 2011-01-06 10:56:32 +0000
3+++ crm/__openerp__.py 2011-01-11 11:11:50 +0000
4@@ -126,6 +126,7 @@
5 'test/test_crm_opportunity.yml',
6 'test/test_crm_phonecall.yml',
7 'test/test_crm_recurrent_meeting.yml',
8+ 'test/test_crm_stage_changes.yml',
9 ],
10 'installable': True,
11 'active': False,
12
13=== added file 'crm/test/test_crm_stage_changes.yml'
14--- crm/test/test_crm_stage_changes.yml 1970-01-01 00:00:00 +0000
15+++ crm/test/test_crm_stage_changes.yml 2011-01-11 11:11:50 +0000
16@@ -0,0 +1,90 @@
17+-
18+ In order to test the changes on stage of a lead or an opportunity with OpenERP,
19+ I create some leads and test the stage changes.
20+-
21+ I want to change the probability to 0.0 when the opportunity is marked as lost.
22+ So I set its Change probability automatically true.
23+-
24+ !record {model: crm.case.stage, id: crm.stage_opportunity6}:
25+ name: Lost
26+ on_change: true
27+ probability: 0.0
28+ section_ids:
29+ - crm.section_sales_department
30+ sequence: 0.0
31+ type: opportunity
32+-
33+ I create a lead 'OpenERP Presentation'.
34+-
35+ !record {model: crm.lead, id: crm_lead_openerppresentation0}:
36+ categ_id: crm.categ_oppor4
37+ day_close: 0.0
38+ day_open: 0.0
39+ name: OpenERP Presentation
40+ planned_revenue: 0.0
41+ probability: 0.0
42+ section_id: crm.section_sales_department
43+-
44+ I open the lead.
45+-
46+ !python {model: crm.lead}: |
47+ self.case_open(cr, uid, [ref('crm_lead_openerppresentation0')])
48+-
49+ I find that this lead can be converted to opportunity.
50+-
51+ !record {model: crm.lead2opportunity, id: crm_lead2opportunity0}:
52+ name: OpenERP Presentation
53+ probability: 60.0
54+ planned_revenue: 45000.0
55+-
56+ So I convert the lead to opportunity.
57+-
58+ !python {model: crm.lead2opportunity}: |
59+ self.action_apply(cr, uid, [ref('crm_lead2opportunity0')], context={'active_id': ref('crm_lead_openerppresentation0')})
60+-
61+ I check that lead is now converted to opportunity.
62+-
63+ !python {model: crm.lead}: |
64+ lead = self.browse(cr, uid, ref('crm_lead_openerppresentation0'))
65+ assert lead.type == 'opportunity', 'Lead is not converted to opportunity!'
66+-
67+ I mark this opportunity as lost.
68+-
69+ !python {model: crm.lead}: |
70+ self.case_mark_lost(cr, uid, [ref('crm_lead_openerppresentation0')])
71+-
72+ Now I check whether the probability is set according to stage change or not.
73+-
74+ !python {model: crm.lead}: |
75+ opportunity = self.browse(cr, uid, ref('crm_lead_openerppresentation0'))
76+ assert opportunity.stage_id.id == ref('crm.stage_opportunity6'), 'Stage is not changed!'
77+ assert opportunity.probability == 0.0, 'Probability is wrong!'
78+-
79+ I create one more opportunity.
80+-
81+ !record {model: crm.lead, id: crm_lead_partnerdemo0}:
82+ categ_id: crm.categ_oppor3
83+ day_close: 0.0
84+ day_open: 0.0
85+ name: Partner Demo
86+ planned_revenue: 50000.0
87+ probability: 70.0
88+ section_id: crm.section_sales_department
89+ type: opportunity
90+-
91+ I open this opportunity.
92+-
93+ !python {model: crm.lead}: |
94+ self.case_open(cr, uid, [ref('crm_lead_partnerdemo0')])
95+-
96+ I mark this opportunity as won.
97+-
98+ !python {model: crm.lead}: |
99+ self.case_close(cr, uid, [ref('crm_lead_partnerdemo0')])
100+-
101+ I check whether the stage is changed to 'Won' and probability is 100.0 or not.
102+-
103+ !python {model: crm.lead}: |
104+ opportunity = self.browse(cr, uid, ref('crm_lead_partnerdemo0'))
105+ assert opportunity.stage_id.id == ref('crm.stage_opportunity5'), 'Stage is not changed!'
106+ assert opportunity.probability == 100.0, 'Probability is wrong!'

Subscribers

People subscribed via source and target branches