2011-10-25 07:39:57 +00:00
|
|
|
|
-
|
|
|
|
|
In order to test convert customer lead into opportunity,
|
2011-10-21 10:04:43 +00:00
|
|
|
|
-
|
2011-10-24 13:30:10 +00:00
|
|
|
|
I open customer lead.
|
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
2012-07-30 10:23:52 +00:00
|
|
|
|
self.case_open(cr, uid, [ref("crm_case_4")])
|
2011-10-24 13:30:10 +00:00
|
|
|
|
-
|
2011-12-06 13:16:17 +00:00
|
|
|
|
I check lead state is "Open".
|
2011-10-24 13:30:10 +00:00
|
|
|
|
-
|
2012-07-30 10:23:52 +00:00
|
|
|
|
!assert {model: crm.lead, id: crm.crm_case_4, string: Lead in open state}:
|
2011-10-24 13:30:10 +00:00
|
|
|
|
- state == "open"
|
2011-12-06 12:36:05 +00:00
|
|
|
|
-
|
2011-12-06 13:16:17 +00:00
|
|
|
|
I create partner from lead.
|
2011-12-06 12:36:05 +00:00
|
|
|
|
-
|
2012-07-30 10:23:52 +00:00
|
|
|
|
!record {model: crm.lead2partner, id: crm_lead2partner_id1, context: '{"active_model": "crm.lead", "active_ids": [ref("crm_case_4")]}'}:
|
2011-12-06 12:36:05 +00:00
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead2partner}: |
|
2012-07-30 10:23:52 +00:00
|
|
|
|
context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_4')], 'active_id': ref('crm_case_4')})
|
2011-12-06 12:36:05 +00:00
|
|
|
|
self.make_partner(cr, uid ,[ref("crm_lead2partner_id1")], context=context)
|
2011-10-24 13:30:10 +00:00
|
|
|
|
-
|
|
|
|
|
I convert lead into opportunity for exiting customer.
|
2011-10-21 10:04:43 +00:00
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
2012-07-30 10:23:52 +00:00
|
|
|
|
self.convert_opportunity(cr, uid ,[ref("crm_case_4")], ref("base.res_partner_2"))
|
2011-10-21 10:04:43 +00:00
|
|
|
|
-
|
2011-10-24 13:30:10 +00:00
|
|
|
|
I check details of converted opportunity.
|
2011-10-21 10:04:43 +00:00
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
2012-07-30 10:23:52 +00:00
|
|
|
|
lead = self.browse(cr, uid, ref('crm_case_4'))
|
2011-10-21 10:04:43 +00:00
|
|
|
|
assert lead.type == 'opportunity', 'Lead is not converted to opportunity!'
|
2012-06-19 07:16:24 +00:00
|
|
|
|
assert lead.partner_id.id == ref("base.res_partner_2"), 'Partner missmatch!'
|
2011-10-21 10:04:43 +00:00
|
|
|
|
assert lead.stage_id.id == ref("stage_lead1"), 'Stage of opportunity is incorrect!'
|
|
|
|
|
-
|
2011-11-23 11:44:59 +00:00
|
|
|
|
Now I begin communication and schedule a phone call with the customer.
|
2011-10-24 13:30:10 +00:00
|
|
|
|
-
|
|
|
|
|
!python {model: crm.opportunity2phonecall}: |
|
|
|
|
|
import time
|
2012-07-30 10:23:52 +00:00
|
|
|
|
context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_4')]})
|
2011-10-24 13:30:10 +00:00
|
|
|
|
call_id = self.create(cr, uid, {'date': time.strftime('%Y-%m-%d %H:%M:%S'),
|
|
|
|
|
'name': "Bonjour M. Jean, Comment êtes-vous? J'ai obtenu votre demande. peut-on parler au sujet de ce pour quelques minutes?"}, context=context)
|
|
|
|
|
self.action_schedule(cr, uid, [call_id], context=context)
|
2011-10-25 07:39:57 +00:00
|
|
|
|
-
|
|
|
|
|
I check that phonecall is scheduled for that opportunity.
|
|
|
|
|
-
|
|
|
|
|
!python {model: crm.phonecall}: |
|
2012-07-30 10:23:52 +00:00
|
|
|
|
ids = self.search(cr, uid, [('opportunity_id', '=', ref('crm_case_4'))])
|
2011-10-25 07:39:57 +00:00
|
|
|
|
assert len(ids), 'phonecall is not scheduled'
|
|
|
|
|
-
|
2011-12-15 12:30:30 +00:00
|
|
|
|
Now I schedule meeting with customer.
|
2011-10-25 07:39:57 +00:00
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
2012-07-30 10:23:52 +00:00
|
|
|
|
self.action_makeMeeting(cr, uid, [ref('crm_case_4')])
|
2011-10-24 13:30:10 +00:00
|
|
|
|
-
|
2011-12-15 12:30:30 +00:00
|
|
|
|
After communicated with customer, I put some notes with contract details.
|
2011-10-24 13:30:10 +00:00
|
|
|
|
-
|
2012-07-11 07:55:57 +00:00
|
|
|
|
!python {model: crm.lead}: |
|
2012-07-30 10:23:52 +00:00
|
|
|
|
self.message_append_note(cr, uid, [ref('crm_case_4')], subject='Test note', body='ces détails envoyés par le client sur le FAX pour la qualité')
|
2011-10-24 13:30:10 +00:00
|
|
|
|
-
|
2012-05-25 10:17:13 +00:00
|
|
|
|
I win this opportunity
|
2011-10-21 10:04:43 +00:00
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
2012-07-30 10:23:52 +00:00
|
|
|
|
self.case_mark_won(cr, uid, [ref("crm_case_4")])
|
2011-10-21 10:04:43 +00:00
|
|
|
|
-
|
2012-05-25 10:17:13 +00:00
|
|
|
|
I check details of the opportunity after having won the opportunity.
|
2011-10-21 10:04:43 +00:00
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
2012-07-30 10:23:52 +00:00
|
|
|
|
lead = self.browse(cr, uid, ref('crm_case_4'))
|
2012-05-24 16:19:25 +00:00
|
|
|
|
assert lead.stage_id.id == ref('crm.stage_lead6'), "Opportunity stage should be 'Won'."
|
2012-05-23 09:19:40 +00:00
|
|
|
|
assert lead.state == 'done', "Opportunity is not in 'done' state!"
|
|
|
|
|
assert lead.probability == 100.0, "Revenue probability should be 100.0!"
|
2011-10-25 07:39:57 +00:00
|
|
|
|
-
|
|
|
|
|
I convert mass lead into opportunity customer.
|
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead2opportunity.partner.mass}: |
|
2012-07-30 10:23:52 +00:00
|
|
|
|
context.update({'active_model': 'crm.lead', 'active_ids': [ref("crm_case_11"), ref("crm_case_2")], 'active_id': ref("crm_case_4")})
|
2011-10-25 07:39:57 +00:00
|
|
|
|
id = self.create(cr, uid, {'user_ids': [ref('base.user_root')], 'section_id': ref('crm.section_sales_department')}, context=context)
|
2011-11-02 11:44:54 +00:00
|
|
|
|
self.mass_convert(cr, uid, [id], context=context)
|
|
|
|
|
-
|
2011-12-15 12:30:30 +00:00
|
|
|
|
Now I check first lead converted on opportunity.
|
2011-11-02 11:44:54 +00:00
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
2012-07-30 10:23:52 +00:00
|
|
|
|
opp = self.browse(cr, uid, ref('crm_case_11'))
|
2011-11-02 11:44:54 +00:00
|
|
|
|
assert opp.name == "Need Info about Onsite Intervention", "Opportunity name not correct"
|
|
|
|
|
assert opp.type == 'opportunity', 'Lead is not converted to opportunity!'
|
|
|
|
|
assert opp.partner_id.name == "Agrolait", 'Partner missmatch!'
|
|
|
|
|
assert opp.stage_id.id == ref("stage_lead1"), 'Stage of probability is incorrect!'
|
|
|
|
|
-
|
2011-12-15 12:30:30 +00:00
|
|
|
|
Then check for second lead converted on opportunity.
|
2011-11-02 11:44:54 +00:00
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
2012-07-30 10:23:52 +00:00
|
|
|
|
opp = self.browse(cr, uid, ref('crm_case_2'))
|
2011-11-02 11:44:54 +00:00
|
|
|
|
assert opp.name == "Interest in Your New Product", "Opportunity name not correct"
|
|
|
|
|
assert opp.type == 'opportunity', 'Lead is not converted to opportunity!'
|
2011-12-07 11:46:48 +00:00
|
|
|
|
assert opp.stage_id.id == ref("stage_lead1"), 'Stage of probability is incorrect!'
|
2012-05-25 10:17:13 +00:00
|
|
|
|
-
|
|
|
|
|
I loose the second opportunity
|
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
2012-07-30 10:23:52 +00:00
|
|
|
|
self.case_mark_lost(cr, uid, [ref("crm_case_2")])
|
2012-05-25 10:17:13 +00:00
|
|
|
|
-
|
|
|
|
|
I check details of the opportunity after the loose
|
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
2012-07-30 10:23:52 +00:00
|
|
|
|
lead = self.browse(cr, uid, ref('crm_case_2'))
|
2012-05-25 10:17:13 +00:00
|
|
|
|
assert lead.stage_id.id == ref('crm.stage_lead8'), "Opportunity stage should be 'Lost'."
|
|
|
|
|
assert lead.state == 'cancel', "Lost opportunity is not in 'cancel' state!"
|
2012-05-25 12:22:34 +00:00
|
|
|
|
assert lead.probability == 0.0, "Revenue probability should be 0.0!"
|
2011-12-07 11:46:48 +00:00
|
|
|
|
-
|
2011-12-15 12:30:30 +00:00
|
|
|
|
I confirm review needs meeting.
|
2011-12-07 11:46:48 +00:00
|
|
|
|
-
|
|
|
|
|
!python {model: crm.meeting}: |
|
|
|
|
|
context.update({'active_model': 'crm.meeting'})
|
2012-07-20 12:12:46 +00:00
|
|
|
|
self.case_open(cr, uid, [ref('base_calendar.crm_case_reviewneeds0')])
|
2011-12-07 11:46:48 +00:00
|
|
|
|
-
|
2011-12-15 12:30:30 +00:00
|
|
|
|
I invite a user for meeting.
|
2011-12-07 11:46:48 +00:00
|
|
|
|
-
|
|
|
|
|
!python {model: calendar.attendee}: |
|
|
|
|
|
meeting_id = self.create(cr, uid, {'user_id': ref('base.user_root'), 'email': 'user@meeting.com' })
|
|
|
|
|
self.do_accept(cr, uid, [meeting_id])
|