2 In order to test convert customer lead into opportunity,
6 !python {model: crm.lead}: |
7 self.case_open(cr, uid, [ref("crm_case_qrecorp0")])
9 I check lead state is "Open".
11 !assert {model: crm.lead, id: crm.crm_case_qrecorp0, string: Lead in open state}:
14 I create partner from lead.
16 !record {model: crm.lead2partner, id: crm_lead2partner_id1, context: '{"active_model": "crm.lead", "active_ids": [ref("crm_case_qrecorp0")]}'}:
18 !python {model: crm.lead2partner}: |
19 context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_qrecorp0')], 'active_id': ref('crm_case_qrecorp0')})
20 self.make_partner(cr, uid ,[ref("crm_lead2partner_id1")], context=context)
22 I convert lead into opportunity for exiting customer.
24 !python {model: crm.lead}: |
25 self.convert_opportunity(cr, uid ,[ref("crm_case_qrecorp0")], ref("base.res_partner_agrolait"))
27 I check details of converted opportunity.
29 !python {model: crm.lead}: |
30 lead = self.browse(cr, uid, ref('crm_case_qrecorp0'))
31 assert lead.type == 'opportunity', 'Lead is not converted to opportunity!'
32 assert lead.partner_id.id == ref("base.res_partner_agrolait"), 'Partner missmatch!'
33 assert lead.stage_id.id == ref("stage_lead1"), 'Stage of opportunity is incorrect!'
35 Now I begin communication and schedule a phone call with the customer.
37 !python {model: crm.opportunity2phonecall}: |
39 context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_qrecorp0')]})
40 call_id = self.create(cr, uid, {'date': time.strftime('%Y-%m-%d %H:%M:%S'),
41 'name': "Bonjour M. Jean, Comment êtes-vous? J'ai obtenu votre demande. peut-on parler au sujet de ce pour quelques minutes?"}, context=context)
42 self.action_schedule(cr, uid, [call_id], context=context)
44 I check that phonecall is scheduled for that opportunity.
46 !python {model: crm.phonecall}: |
47 ids = self.search(cr, uid, [('opportunity_id', '=', ref('crm_case_qrecorp0'))])
48 assert len(ids), 'phonecall is not scheduled'
50 Now I schedule meeting with customer.
52 !python {model: crm.lead}: |
53 self.action_makeMeeting(cr, uid, [ref('crm_case_qrecorp0')])
55 After communicated with customer, I put some notes with contract details.
57 !python {model: crm.add.note}: |
58 context.update({'active_model': 'crm.lead', 'active_id': ref('crm_case_qrecorp0')})
59 note_id = self.create(cr, uid, {'body': "ces détails envoyés par le client sur le FAX pour la qualité"})
60 self.action_add(cr, uid, [note_id], context=context)
62 I win this opportunity
64 !python {model: crm.lead}: |
65 self.case_mark_won(cr, uid, [ref("crm_case_qrecorp0")])
67 I check details of the opportunity after having won the opportunity.
69 !python {model: crm.lead}: |
70 lead = self.browse(cr, uid, ref('crm_case_qrecorp0'))
71 assert lead.stage_id.id == ref('crm.stage_lead6'), "Opportunity stage should be 'Won'."
72 assert lead.state == 'done', "Opportunity is not in 'done' state!"
73 assert lead.probability == 100.0, "Revenue probability should be 100.0!"
75 I convert mass lead into opportunity customer.
77 !python {model: crm.lead2opportunity.partner.mass}: |
78 context.update({'active_model': 'crm.lead', 'active_ids': [ref("crm_case_employee0"), ref("crm_case_electonicgoodsdealer0")], 'active_id': ref("crm_case_qrecorp0")})
79 id = self.create(cr, uid, {'user_ids': [ref('base.user_root')], 'section_id': ref('crm.section_sales_department')}, context=context)
80 self.mass_convert(cr, uid, [id], context=context)
82 Now I check first lead converted on opportunity.
84 !python {model: crm.lead}: |
85 opp = self.browse(cr, uid, ref('crm_case_employee0'))
86 assert opp.name == "Need Info about Onsite Intervention", "Opportunity name not correct"
87 assert opp.type == 'opportunity', 'Lead is not converted to opportunity!'
88 assert opp.partner_id.name == "Agrolait", 'Partner missmatch!'
89 assert opp.stage_id.id == ref("stage_lead1"), 'Stage of probability is incorrect!'
91 Then check for second lead converted on opportunity.
93 !python {model: crm.lead}: |
94 opp = self.browse(cr, uid, ref('crm_case_electonicgoodsdealer0'))
95 assert opp.name == "Interest in Your New Product", "Opportunity name not correct"
96 assert opp.type == 'opportunity', 'Lead is not converted to opportunity!'
97 assert opp.stage_id.id == ref("stage_lead1"), 'Stage of probability is incorrect!'
99 I loose the second opportunity
101 !python {model: crm.lead}: |
102 self.case_mark_won(cr, uid, [ref("crm_case_electonicgoodsdealer0")])
104 I check details of the opportunity after the loose
106 !python {model: crm.lead}: |
107 lead = self.browse(cr, uid, ref('crm_case_qrecorp0'))
108 assert lead.stage_id.id == ref('crm.stage_lead8'), "Opportunity stage should be 'Lost'."
109 assert lead.state == 'cancel', "Lost opportunity is not in 'cancel' state!"
110 assert lead.probability == 100.0, "Revenue probability should be 100.0!"
112 I confirm review needs meeting.
114 !python {model: crm.meeting}: |
115 context.update({'active_model': 'crm.meeting'})
116 self.case_open(cr, uid, [ref('crm.crm_case_reviewneeds0')])
118 I invite a user for meeting.
120 !python {model: calendar.attendee}: |
121 meeting_id = self.create(cr, uid, {'user_id': ref('base.user_root'), 'email': 'user@meeting.com' })
122 self.do_accept(cr, uid, [meeting_id])