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}: |
|
|
|
|
|
self.case_open(cr, uid, [ref("crm_case_qrecorp0")])
|
|
|
|
|
-
|
2011-10-25 07:39:57 +00:00
|
|
|
|
I check lead is in open.
|
2011-10-24 13:30:10 +00:00
|
|
|
|
-
|
|
|
|
|
!assert {model: crm.lead, id: crm.crm_case_qrecorp0, string: Lead in open state}:
|
|
|
|
|
- state == "open"
|
|
|
|
|
-
|
|
|
|
|
I convert lead into opportunity for exiting customer.
|
2011-10-21 10:04:43 +00:00
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
|
|
|
|
self.convert_opportunity(cr, uid ,[ref("crm_case_qrecorp0")], ref("base.res_partner_agrolait"))
|
|
|
|
|
-
|
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}: |
|
|
|
|
|
lead = self.browse(cr, uid, ref('crm_case_qrecorp0'))
|
|
|
|
|
assert lead.type == 'opportunity', 'Lead is not converted to opportunity!'
|
|
|
|
|
assert lead.partner_id.id == ref("base.res_partner_agrolait"), 'Partner missmatch!'
|
|
|
|
|
assert lead.stage_id.id == ref("stage_lead1"), 'Stage of opportunity is incorrect!'
|
|
|
|
|
-
|
2011-10-25 07:39:57 +00:00
|
|
|
|
Now I start Communication and schedule phonecall with customer.
|
2011-10-24 13:30:10 +00:00
|
|
|
|
-
|
|
|
|
|
!python {model: crm.opportunity2phonecall}: |
|
|
|
|
|
import time
|
|
|
|
|
context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_qrecorp0')]})
|
|
|
|
|
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}: |
|
|
|
|
|
ids = self.search(cr, uid, [('opportunity_id', '=', ref('crm_case_qrecorp0'))])
|
|
|
|
|
assert len(ids), 'phonecall is not scheduled'
|
|
|
|
|
-
|
|
|
|
|
Now I schedule Meeting with Customer.
|
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
|
|
|
|
self.action_makeMeeting(cr, uid, [ref('crm_case_qrecorp0')])
|
|
|
|
|
|
2011-10-24 13:30:10 +00:00
|
|
|
|
-
|
|
|
|
|
After communicated with customer, I put some notes with Contract details.
|
|
|
|
|
-
|
|
|
|
|
!python {model: crm.add.note}: |
|
|
|
|
|
context.update({'active_model': 'crm.lead', 'active_id': ref('crm_case_qrecorp0')})
|
|
|
|
|
note_id = self.create(cr, uid, {'body': "ces détails envoyés par le client sur le FAX pour la qualité"})
|
|
|
|
|
self.action_add(cr, uid, [note_id], context=context)
|
|
|
|
|
-
|
|
|
|
|
Finally, I won this opportunity, so I close this opportunity.
|
2011-10-21 10:04:43 +00:00
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
|
|
|
|
self.case_mark_won(cr, uid, [ref("crm_case_qrecorp0")])
|
|
|
|
|
-
|
2011-10-24 13:30:10 +00:00
|
|
|
|
I check details of the opportunity After won the opportunity.
|
2011-10-21 10:04:43 +00:00
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
|
|
|
|
lead = self.browse(cr, uid, ref('crm_case_qrecorp0'))
|
|
|
|
|
assert lead.state == 'done', 'Opportunity is not in done state!'
|
|
|
|
|
assert lead.stage_id.name == 'Won', ' Stage of Opportunity is not win!'
|
|
|
|
|
assert lead.probability == 100.0, 'probability revenue should not be 100.0!'
|
2011-10-25 07:39:57 +00:00
|
|
|
|
-
|
|
|
|
|
I convert mass lead into opportunity customer.
|
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead2opportunity.partner.mass}: |
|
2011-11-02 11:44:54 +00:00
|
|
|
|
context.update({'active_model': 'crm.lead', 'active_ids': [ref("crm_case_employee0"), ref("crm_case_electonicgoodsdealer0")], 'active_id': ref("crm_case_qrecorp0")})
|
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)
|
|
|
|
|
-
|
|
|
|
|
Now i check First lead converted on opportunity.
|
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
|
|
|
|
opp = self.browse(cr, uid, ref('crm_case_employee0'))
|
|
|
|
|
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!'
|
|
|
|
|
-
|
|
|
|
|
Then check for Second lead converted on opportunity.
|
|
|
|
|
-
|
|
|
|
|
!python {model: crm.lead}: |
|
|
|
|
|
opp = self.browse(cr, uid, ref('crm_case_electonicgoodsdealer0'))
|
|
|
|
|
assert opp.name == "Interest in Your New Product", "Opportunity name not correct"
|
|
|
|
|
assert opp.type == 'opportunity', 'Lead is not converted to opportunity!'
|
|
|
|
|
assert opp.stage_id.id == ref("stage_lead1"), 'Stage of probability is incorrect!'
|