[IMP] crm, crm_partner_assign: checked spelling and put email_from to send email...
[odoo/odoo.git] / addons / crm / test / process / lead2opportunity2win.yml
1 -
2   In order to test convert customer lead into opportunity, 
3 -
4   I open customer lead.
5 -
6    !python {model: crm.lead}: |
7      self.case_open(cr, uid, [ref("crm_case_qrecorp0")])
8
9   I check lead state is "Open".
10 -
11   !assert {model: crm.lead, id: crm.crm_case_qrecorp0, string: Lead in open state}:
12      - state == "open"
13 -
14   I convert lead into opportunity for exiting customer.
15 -
16   !python {model: crm.lead}: |
17     self.convert_opportunity(cr, uid ,[ref("crm_case_qrecorp0")], ref("base.res_partner_agrolait"))
18 -
19   I check details of converted opportunity. 
20 -
21   !python {model: crm.lead}: |
22     lead = self.browse(cr, uid, ref('crm_case_qrecorp0'))
23     assert lead.type == 'opportunity', 'Lead is not converted to opportunity!'
24     assert lead.partner_id.id == ref("base.res_partner_agrolait"), 'Partner missmatch!'
25     assert lead.stage_id.id == ref("stage_lead1"), 'Stage of opportunity is incorrect!'
26 -
27   Now I begin communication and schedule a phone call with the customer.
28 -
29   !python {model: crm.opportunity2phonecall}: |
30     import time
31     context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_qrecorp0')]})
32     call_id = self.create(cr, uid, {'date': time.strftime('%Y-%m-%d %H:%M:%S'), 
33                 'name': "Bonjour M. Jean, Comment êtes-vous? J'ai obtenu votre demande. peut-on parler au sujet de ce pour quelques minutes?"}, context=context)
34     self.action_schedule(cr, uid, [call_id], context=context)
35 -
36   I check that phonecall is scheduled for that opportunity.
37 -
38   !python {model: crm.phonecall}: |
39     ids = self.search(cr, uid, [('opportunity_id', '=', ref('crm_case_qrecorp0'))])
40     assert len(ids), 'phonecall is not scheduled'
41 -
42   Now I schedule Meeting with Customer.
43 -
44   !python {model: crm.lead}: |
45     self.action_makeMeeting(cr, uid, [ref('crm_case_qrecorp0')])
46
47 -
48   After communicated  with customer, I put some notes with Contract details.
49 -
50   !python {model: crm.add.note}: |
51     context.update({'active_model': 'crm.lead', 'active_id': ref('crm_case_qrecorp0')})
52     note_id = self.create(cr, uid, {'body': "ces détails envoyés par le client sur ​​le FAX pour la qualité"})
53     self.action_add(cr, uid, [note_id], context=context)
54 -
55   Finally, I won this opportunity, so I close this opportunity.
56 -
57   !python {model: crm.lead}: |
58     self.case_mark_won(cr, uid, [ref("crm_case_qrecorp0")])
59 -
60   I check details of the opportunity After won the opportunity.
61 -
62   !python {model: crm.lead}: |
63     lead = self.browse(cr, uid, ref('crm_case_qrecorp0'))
64     assert lead.state == 'done', 'Opportunity is not in done state!'
65     assert lead.stage_id.name == 'Won', ' Stage of Opportunity is not win!'
66     assert lead.probability == 100.0, 'probability revenue should not  be 100.0!'
67 -
68   I convert mass lead into opportunity customer.
69 -
70   !python {model: crm.lead2opportunity.partner.mass}: |
71     context.update({'active_model': 'crm.lead', 'active_ids': [ref("crm_case_employee0"), ref("crm_case_electonicgoodsdealer0")], 'active_id': ref("crm_case_qrecorp0")}) 
72     id = self.create(cr, uid, {'user_ids': [ref('base.user_root')], 'section_id': ref('crm.section_sales_department')}, context=context)
73     self.mass_convert(cr, uid, [id], context=context)
74 -
75   Now I check First lead converted on opportunity.
76 -
77   !python {model: crm.lead}: |
78     opp = self.browse(cr, uid, ref('crm_case_employee0'))
79     assert opp.name == "Need Info about Onsite Intervention", "Opportunity name not correct"
80     assert opp.type == 'opportunity', 'Lead is not converted to opportunity!'
81     assert opp.partner_id.name == "Agrolait", 'Partner missmatch!'
82     assert opp.stage_id.id == ref("stage_lead1"), 'Stage of probability is incorrect!'
83 -
84   Then check for Second lead converted on opportunity.
85 -
86   !python {model: crm.lead}: |
87     opp = self.browse(cr, uid, ref('crm_case_electonicgoodsdealer0'))
88     assert opp.name == "Interest in Your New Product", "Opportunity name not correct"
89     assert opp.type == 'opportunity', 'Lead is not converted to opportunity!'
90     assert opp.stage_id.id == ref("stage_lead1"), 'Stage of probability is incorrect!'