diff options
| author | Harry (OpenERP) <hmo@tinyerp.com> | 2011-12-14 17:59:24 +0530 |
|---|---|---|
| committer | Harry (OpenERP) <hmo@tinyerp.com> | 2011-12-14 17:59:24 +0530 |
| commit | 092f97b32b35af6a40b9d2ae70c3159da2fb235f (patch) | |
| tree | 2974d3719af9338cd0b1814da900d7e9ca8d4779 /addons/crm/test/process | |
| parent | 593f5f571bbc49673975afc405e9345ef3457b92 (diff) | |
| parent | e36dc8c5e3ca3da1474747bae5ec87fea19b23b8 (diff) | |
[MERGE] merged with trunk-development-branch
bzr revid: hmo@tinyerp.com-20111214122924-izzibrz1yz67rt7g
Diffstat (limited to 'addons/crm/test/process')
| -rw-r--r-- | addons/crm/test/process/cancel_lead.yml | 53 | ||||
| -rw-r--r-- | addons/crm/test/process/communication_with_customer.yml | 56 | ||||
| -rw-r--r-- | addons/crm/test/process/lead2opportunity2win.yml | 90 | ||||
| -rw-r--r-- | addons/crm/test/process/merge_opportunity.yml | 51 | ||||
| -rw-r--r-- | addons/crm/test/process/segmentation.yml | 16 |
5 files changed, 266 insertions, 0 deletions
diff --git a/addons/crm/test/process/cancel_lead.yml b/addons/crm/test/process/cancel_lead.yml new file mode 100644 index 00000000000..a5f85a14058 --- /dev/null +++ b/addons/crm/test/process/cancel_lead.yml @@ -0,0 +1,53 @@ +- + I cancel unqualified lead. +- + !python {model: crm.lead}: | + self.case_cancel(cr, uid, [ref("crm_case_itisatelesalescampaign0")]) +- + I check cancelled lead. +- + !assert {model: crm.lead, id: crm.crm_case_itisatelesalescampaign0, string: Lead is in cancel state}: + - state == "cancel" +- + I reset cancelled lead into unqualified lead. +- + !python {model: crm.lead}: | + self.case_reset(cr, uid, [ref("crm_case_itisatelesalescampaign0")]) +- + I check unqualified lead after reset. +- + !assert {model: crm.lead, id: crm.crm_case_itisatelesalescampaign0, string: Lead is in draft state}: + - state == "draft" +- + I put unqualified lead into pending. +- + !python {model: crm.lead}: | + self.case_pending(cr, uid, [ref("crm_case_itisatelesalescampaign0")]) +- + I check status of pending lead. +- + !assert {model: crm.lead, id: crm.crm_case_itisatelesalescampaign0, string: Lead is in pending state}: + - state == "pending" +- + I Escalate the Lead to Parent Team. +- + !python {model: crm.lead}: | + self.case_escalate(cr, uid, [ref("crm_case_itisatelesalescampaign0")]) +- + I check lead escalate to Parent Team. +- + !assert {model: crm.lead, id: crm.crm_case_itisatelesalescampaign0, string: Escalate lead to parent team}: + - section_id.name == "Sales Department" +- + I mark as lost the opportunity. +- + !python {model: crm.lead}: | + self.case_mark_lost(cr, uid, [ref("crm_case_itisatelesalescampaign0")]) +- + I check opportunity after lost. +- + !python {model: crm.lead}: | + lead = self.browse(cr, uid, ref('crm_case_itisatelesalescampaign0')) + assert lead.state == 'done', "lead is not done state" + assert lead.stage_id.id == ref('crm.stage_lead6'), 'Stage is not changed!' + assert lead.probability == 0.0, 'Probability is wrong!' diff --git a/addons/crm/test/process/communication_with_customer.yml b/addons/crm/test/process/communication_with_customer.yml new file mode 100644 index 00000000000..92e711ce016 --- /dev/null +++ b/addons/crm/test/process/communication_with_customer.yml @@ -0,0 +1,56 @@ +- + Customer interested in our product. so He send request by email to get more details. +- + Mail script will be fetched him request from mail server. so I process that mail after read EML file +- + !python {model: mail.thread}: | + import addons + request_file = open(addons.get_module_resource('crm','test', 'customer_request.eml'),'rb') + request_message = request_file.read() + self.message_process(cr, uid, 'crm.lead', request_message) +- + After getting the mail, I check details of new lead of that customer. +- + !python {model: crm.lead}: | + lead_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')]) + assert lead_ids and len(lead_ids), "Lead is not created after getting request" + lead = self.browse(cr, uid, lead_ids[0], context=context) + assert not lead.partner_id, "Customer should be a new" + assert lead.name == "Fournir votre devis avec le meilleur prix.", "Subject does not match" +- + I reply him request with welcome message. +- + !python {model: mail.compose.message}: | + lead_ids = self.pool.get('crm.lead').search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')]) + context.update({'active_model': 'crm.lead','active_id': lead_ids[0]}) + id = self.create(cr, uid, {'body_text': "Merci à l'intérêt pour notre produit.nous vous contacterons bientôt. Merci", 'email_from': 'sales@mycompany.com'}, context=context) + try: + self.send_mail(cr, uid, [id], context=context) + except: + pass +- + Now, I convert him into customer and put into regular customer list. +- + !python {model: crm.lead}: | + lead_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')]) + self.convert_partner(cr, uid, lead_ids, context=context) +- + Now, I search customer in regular customer list. +- + !python {model: crm.lead}: | + partner_ids = self.message_partner_by_email(cr, uid, 'Mr. John Right <info@customer.com>') + assert partner_ids.get('partner_id'), "Customer is not found in regular customer list." +- + I convert one phonecall request as a customer and put into regular customer list. +- + !python {model: crm.phonecall}: | + self.convert_partner(cr, uid, [ref('crm.crm_case_phone06')], context=context) +- + I check converted phonecall to partner. +- + !python {model: res.partner}: | + partner_id = self.search(cr, uid, [('phonecall_ids', '=', ref('crm.crm_case_phone06'))]) + assert partner_id, "Customer is not found in regular customer list." + data = self.browse(cr, uid, partner_id, context=context)[0] + assert data.user_id.id == ref("base.user_root"), "User not assign properly" + assert data.name == "Bad time", "User not assign properly" diff --git a/addons/crm/test/process/lead2opportunity2win.yml b/addons/crm/test/process/lead2opportunity2win.yml new file mode 100644 index 00000000000..dbc04abae19 --- /dev/null +++ b/addons/crm/test/process/lead2opportunity2win.yml @@ -0,0 +1,90 @@ +- + In order to test convert customer lead into opportunity, +- + I open customer lead. +- + !python {model: crm.lead}: | + self.case_open(cr, uid, [ref("crm_case_qrecorp0")]) +- + I check lead state is "Open". +- + !assert {model: crm.lead, id: crm.crm_case_qrecorp0, string: Lead in open state}: + - state == "open" +- + I convert lead into opportunity for exiting customer. +- + !python {model: crm.lead}: | + self.convert_opportunity(cr, uid ,[ref("crm_case_qrecorp0")], ref("base.res_partner_agrolait")) +- + I check details of converted opportunity. +- + !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!' +- + Now I begin communication and schedule a phone call with the customer. +- + !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) +- + 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')]) + +- + 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. +- + !python {model: crm.lead}: | + self.case_mark_won(cr, uid, [ref("crm_case_qrecorp0")]) +- + I check details of the opportunity After won the opportunity. +- + !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!' +- + I convert mass lead into opportunity customer. +- + !python {model: crm.lead2opportunity.partner.mass}: | + context.update({'active_model': 'crm.lead', 'active_ids': [ref("crm_case_employee0"), ref("crm_case_electonicgoodsdealer0")], 'active_id': ref("crm_case_qrecorp0")}) + id = self.create(cr, uid, {'user_ids': [ref('base.user_root')], 'section_id': ref('crm.section_sales_department')}, context=context) + 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!'
\ No newline at end of file diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml new file mode 100644 index 00000000000..463e330fc10 --- /dev/null +++ b/addons/crm/test/process/merge_opportunity.yml @@ -0,0 +1,51 @@ +- + I make direct opportunity for Customer. +- + !python {model: crm.partner2opportunity}: | + context.update({'active_model': 'res.partner', 'active_ids': [ref("base.res_partner_9")]}) + res_id = self.create(cr, uid, {'name': "enquête pour l'achat de services"}, context=context) + self.make_opportunity(cr, uid, [res_id], context=context) +- + I make another opportunity from phonecall for same customer. +- + !python {model: crm.phonecall2opportunity}: | + context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")]}) + res_id = self.create(cr, uid, {'name': "Quoi de prix de votre autre service?", 'partner_id': ref("base.res_partner_9")}, context=context) + self.make_opportunity(cr, uid, [res_id], context=context) +- + Now I merge all opportunities of customer. +- + !python {model: crm.lead}: | + opportunity_ids = self.search(cr, uid, [('partner_id','=', ref("base.res_partner_9"))]) + self.merge_opportunity(cr, uid, opportunity_ids, context=context) +- + I check for merged opportunities for customer. +- + !python {model: crm.lead}: | + merge_id = self.search(cr, uid, [('partner_id','=', ref("base.res_partner_9"))]) + assert merge_id, 'Fail to create Merge opportunity' + merge_data = self.browse(cr, uid, merge_id)[0] + assert merge_data.type == 'opportunity', 'Merged opportunity type not change!' + assert merge_data.partner_id.id == ref("base.res_partner_9"), 'Partner missmatch!' +- + Now I schedule another phonecall to customer after merged. +- + !python {model: crm.phonecall2phonecall}: | + context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")]}) + res_id = self.create(cr, uid, {'name': "vos chances sont fusionnés en un seul"}, context=context) + self.action_schedule(cr, uid, [res_id], context=context) +- + I schedule Meeting on this phonecall. +- + !python {model: crm.phonecall}: | + self.action_make_meeting(cr, uid, [ref("crm.crm_case_phone06")]) +- + I setting Phone call to Held (Done). +- + !python {model: crm.phonecall}: | + self.case_close(cr, uid, [ref("crm.crm_case_phone06")]) +- + I check that the phone call is in 'Held' state. +- + !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call Helded}: + - state == "done" diff --git a/addons/crm/test/process/segmentation.yml b/addons/crm/test/process/segmentation.yml new file mode 100644 index 00000000000..74500049290 --- /dev/null +++ b/addons/crm/test/process/segmentation.yml @@ -0,0 +1,16 @@ +- + In order to test segmentation process which create specific partner categories criteria, +- + I start the process. +- + !python {model: crm.segmentation}: | + self.process_start(cr, uid, [ref("crm_segmentation0")],context) + #Todo: Need to check after segmentation started + +- + I create rule Segmentation line record for partner . +- + !python {model: crm.segmentation.line}: | + id = self.create(cr, uid, {'name': "OpenERP partners",'expr_value': 25}) + self.test(cr, uid, [id],partner_id=0) + #Todo: Need to test segmantation line record
\ No newline at end of file |
