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 | |
| 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')
21 files changed, 335 insertions, 1064 deletions
diff --git a/addons/crm/test/customer_request.eml b/addons/crm/test/customer_request.eml new file mode 100644 index 00000000000..2c6c5e8110d --- /dev/null +++ b/addons/crm/test/customer_request.eml @@ -0,0 +1,30 @@ +Return-Path: <info@customer.com>
+X-Original-To: info@customer.com
+Delivered-To: sales@my.com
+Received: by mail.my.com (Postfix, from userid xxx)
+ id 822ECBFB67; Mon, 24 Oct 2011 07:36:51 +0200 (CEST)
+X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.my.com
+X-Spam-Level:
+X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=ham
+ version=3.3.1
+Received: from [192.168.1.146]
+ (Authenticated sender: info@mail.customer.com)
+ by mail.customer.com (Postfix) with ESMTPSA id 07A30BFAB4
+ for <sales@my.com>; Mon, 24 Oct 2011 07:36:50 +0200 (CEST)
+Message-ID: <4EA4F95D.904@customer.com>
+Date: Mon, 24 Oct 2011 11:06:29 +0530
+From: Mr. John Right <info@customer.com>
+User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8
+MIME-Version: 1.0
+To: sales@my.com
+Subject: Fournir votre devis avec le meilleur prix.
+Content-Type: text/plain; charset=ISO-8859-1; format=flowed
+Content-Transfer-Encoding: 8bit
+
+Bonjour l'équipe de vente,
+
+Je veux acheter vos produits et services.
+
+S'il vous plaît fournir votre cotation avec le meilleur prix.
+
+Merci
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 diff --git a/addons/crm/test/test_crm_lead.yml b/addons/crm/test/test_crm_lead.yml deleted file mode 100644 index d5d3c6b933b..00000000000 --- a/addons/crm/test/test_crm_lead.yml +++ /dev/null @@ -1,154 +0,0 @@ -- - In order to test the CRM in OpenERP, I will do a customer qualification - process that starts with a fist contact with a customer (a lead), which will - be converted to a business opportunity and a partner. -- - I create a two new users "user_crm" and I assign the group "salesman". -- - !record {model: res.users, id: res_users_usercrm0}: - company_id: base.main_company - context_lang: en_US - context_section_id: crm.section_sales_department - groups_id: - - base.group_sale_salesman - login: user_crm - name: user_crm - password: user_crm - -- | - I start by creating a new lead "New Customer" and I provide an address to this - new customer, as well as an email "info@mycustomer.com". -- - !record {model: crm.lead, id: crm_lead_newcustomer0}: - email_from: info@mycustomer.com - name: New Customer - partner_name: Capegemini - partner_id: base.res_partner_9 - phone: (855) 924-4364 - mobile: (333) 715-1450 - section_id: crm.section_sales_department - referred: False -- | - I check that the lead is in 'draft' state. -- - !assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in Draft}: - - state == "draft" -- - I open lead by click on "Open" button. -- - !python {model: crm.lead}: | - self.case_open(cr, uid, [ref("crm_lead_newcustomer0")]) - fields={ - 'day_open': 0.0, - 'day_close': 0.0 - } - self._compute_day(cr, uid, [ref("crm_lead_newcustomer0")], fields, context) -- | - I check that lead is now in 'open' state. -- - !assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in open state}: - - state == "open" -- - I search id for case object. -- - !python {model: crm.case.categ}: | - self._find_object_id(cr, uid, context) -- | - As the lead seems to be a real business opportunity, I will convert it to a - partner - and a business opportunity by clicking on the "Convert" button. -- - !python {model: crm.lead}: | - lead = self.browse(cr, uid, ref('crm_lead_newcustomer0')) - action = self.convert_opportunity(cr, uid, [ref("crm_lead_newcustomer0")], {'active_ids': [ref("crm_lead_newcustomer0")]}) - assert action['res_model'] == 'crm.lead2opportunity.partner' -- - | - I select "create a new partner" option. -- - !record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_create_0}: - action: 'create' - name: 'convert' -- - Then, Click on "Create Opportunity" button. -- - !python {model: crm.lead2opportunity.partner}: | - self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_create_0")], {'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")}) -- - | - I select "Link to an existing partner" option. -- - !record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_create_1}: - action: 'exist' -- - Then, Click on "Create Opportunity" button. -- - !python {model: crm.lead2opportunity.partner}: | - self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_create_1")], {'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")}) -- - | - I select "Do not link to a partner" option. -- - !record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_create_2}: - action: 'nothing' -- - Then, Click on "Create Opportunity" button. -- - !python {model: crm.lead2opportunity.partner}: | - self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_create_2")], {'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")}) -- | - In order to check the opportunity is created or not, I check type. -- - !python {model: crm.lead}: | - lead = self.browse(cr, uid, ref("crm_lead_newcustomer0")) - assert lead.type == 'opportunity' - -- - I create mass report of lead to opprtunity partner. -- - !record {model: crm.lead2opportunity.partner.mass, id: crm_lead2opportunity_partner_mass0}: - user_ids: - - base.user_root - section_id: crm.section_sales_department -- - Then, execute that mass wizard. -- - !python {model: crm.lead2opportunity.partner.mass}: | - self.mass_convert(cr, uid, [ref("crm_lead2opportunity_partner_mass0")],{'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")}) -- - I close lead by click on "close" button. -- - !python {model: crm.lead}: | - self.case_close(cr, uid, [ref("crm_lead_newcustomer0")]) -- | - I check that lead is now in 'done' state. -- - !assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in done state}: - - state == "done" -- - I cancel lead by click on "cancel" button. -- - !python {model: crm.lead}: | - self.case_cancel(cr, uid, [ref("crm_lead_newcustomer0")]) -- | - I check that lead is now in 'cancel' state. -- - !assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in cancel state}: - - state == "cancel" - -#- -# | -# yaml is also not working with smtp server and send new email. - -- | - I configure with smtp server. -- | - And I communicate with lead through send New mail to Lead using its email address from the user who is logged in. -- | - I check that communication history generated when send email to lead. -- | - Then, I add a cc which receive copy of future communication between partner and users by mail. - -- | - I Reply to last Email to lead with some document attached.and check that communication history generated or not. - diff --git a/addons/crm/test/test_crm_lead_case2.yml b/addons/crm/test/test_crm_lead_case2.yml deleted file mode 100644 index 23a654d31a8..00000000000 --- a/addons/crm/test/test_crm_lead_case2.yml +++ /dev/null @@ -1,151 +0,0 @@ -- - In order to do complete test the CRM in OpenERP, - I will create new full configured record and carry test on it. -- | - I Start by creating "Test Sales Team" with No Unlink. - I create a crm.case.section record. -- - !record {model: crm.case.section, id: crm_case_section_demosalesteam}: - code: DEMO - complete_name: Test Sales Team - name: Test Sales Team - allow_unlink: False - member_ids: - - base.user_admin - stage_ids: - - crm.stage_lead1 - - crm.stage_lead2 - - crm.stage_lead3 - - crm.stage_lead4 - - crm.stage_lead5 - - crm.stage_lead6 - working_hours: 0.0 - resource_calendar_id: resource.timesheet_group1 - parent_id: crm.section_sales_department -- - I assign segmentation. -- - !record {model: res.users, id: res_users_usercrm0}: - context_section_id: crm_case_section_demosalesteam -- | - I create a new lead "Test Customer" and I provide an address to this - demo customer and email "info@democustomer.com" and Also "Test Sales Team". -- - !record {model: crm.lead, id: crm_lead_democustomer}: - email_from: info@democustomer.com - name: Test Customer - partner_name: NotSoTinySARL - phone: (+32).81.81.37.00 - mobile: (+32).81.81.37.00 - section_id: crm_case_section_demosalesteam - referred: False - type: lead -- - I check that the lead is in 'draft' state. -- - !assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in Draft}: - - state == "draft" -- - I create categories. -- - !record {model: crm.case.categ, id: crm_case_categ0}: - name: crm_case_section_demosalesteam - section_id: crm_case_section_demosalesteam -- - I assigning contact detail to the Lead "Test Customer" without address. -- - !python {model: crm.lead}: | - self.onchange_partner_address_id(cr, uid, ref("crm_lead_democustomer"), None, email=False) - -- - I assigning contact detail to the Lead "Test Customer" with address. -- - !python {model: crm.lead}: | - self.onchange_partner_address_id(cr, uid, ref("crm_lead_democustomer"), ref("base.res_partner_address_notsotinysarl0"), email=False) - -- - I selecting email "Opt-out" option for the "Test Customer" Lead. -- - !python {model: crm.lead}: | - self.on_change_optout(cr, uid, ref("crm_lead_democustomer"), True) - -- - I change the Opt-out to Opt-in to show email receive preference. -- - !python {model: crm.lead}: | - self.on_change_optin(cr, uid, ref("crm_lead_democustomer"), True) -- - I open lead by click on "Open" button. -- - !python {model: crm.lead}: | - self.case_open(cr, uid, [ref("crm_lead_democustomer")]) -- - I check that lead "Test Customer" is now in 'open' state. -- - !assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in open state}: - - state == "open" -- - I reset the lead "Test Customer". -- - !python {model: crm.lead}: | - self.case_reset(cr, uid, [ref("crm_lead_democustomer")]) -- - I again opening lead by click on "Open" button. -- - !python {model: crm.lead}: | - self.case_open(cr, uid, [ref("crm_lead_democustomer")]) -- - I setting stage "New" for the lead "Test Customer". -- - !python {model: crm.lead}: | - self.stage_next(cr, uid, [ref("crm_lead_democustomer")], context={'stage_type': 'lead'}) -- - I try to Unlink the Lead "Test Customer" demo Lead. -- - !python {model: crm.lead}: | - try: - self.unlink(cr, uid, [ref("crm_lead_democustomer")]) - except: - pass -- - I setting Lead "Test Customer" to Pending State. -- - !python {model: crm.lead}: | - self.case_pending(cr, uid, [ref("crm_lead_democustomer")]) -- - I check that lead "Test Customer" is now in 'Pending' state. -- - !assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in Pending state}: - - state == "pending" -- - I Escalate the Lead "Test Customer" Parent "Sales Team". -- - !python {model: crm.lead}: | - self.case_escalate(cr, uid, [ref("crm_lead_democustomer")]) -- - I add Internal Note Saying Escalated Reason. -- - !record {model: crm.add.note, id: crm_add_note_0}: - body: Sales Lead Has Been Escalated Due to Some Technical reason to the parent 'Sales - Team' - state: unchanged -- - I click a note button to attach the record. -- - !python {model: crm.add.note}: | - context['active_model'] = "crm.lead" - context['active_ids'] = [ref("crm_lead_democustomer")] - self.action_add(cr, uid, [ref("crm_add_note_0")], context=context) - -- - I Copying this lead "Test Customer" to New Lead. -- - !python {model: crm.lead}: | - self.copy(cr, uid, ref("crm_lead_democustomer")) -- - I checking the Lead Copied or Not. -- - !python {model: crm.lead}: | - sid = self.search(cr, uid, [('name', '=', 'Test Customer'),('state', '=', 'draft')]) - if not sid: - raise AssertionError("Lead is not copied Successfully") diff --git a/addons/crm/test/test_crm_meeting.yml b/addons/crm/test/test_crm_meeting.yml deleted file mode 100644 index 1aee11463dd..00000000000 --- a/addons/crm/test/test_crm_meeting.yml +++ /dev/null @@ -1,97 +0,0 @@ -- | - I will test Meetings which may be customer meeting or phonecall meeting or - internal Meeting. -- | - I start by creating a new Meeting. -- - !record {model: crm.meeting, id: crm_meeting_regardingpresentation0}: - categ_id: crm.categ_meet2 - date: !eval time.strftime('%Y-%m-%d 16:04:00') - date_deadline: !eval "(datetime.now() + timedelta(1)).strftime('%Y-%m-%d 00:04:00')" - duration: 8.0 - email_from: info@balmerinc.be - location: Ahmedabad - name: Regarding Presentation - partner_address_id: base.res_partner_address_1 - partner_id: base.res_partner_9 - rrule_type: weekly - section_id: crm.section_sales_department -- | - I check that the Meetings is in 'UnConfirmed' state. -- - !assert {model: crm.meeting, id: crm_meeting_regardingpresentation0}: - - state == "draft" -- | - I can set reminder on meeting if I put reminder "40 minutes before" . -- | - For that, I first create alarm. -- - !record {model: res.alarm, id: res_alarm_minituesbefore0}: - name: 40 minutes before - trigger_duration: 40 - trigger_interval: minutes - trigger_occurs: before - trigger_related: start -- | - I will assign this reminder. - -- !python {model: crm.meeting}: | - self.write(cr, uid, [ref('crm_meeting_regardingpresentation0')], {'alarm_id': ref("res_alarm_minituesbefore0")}) -- | - In order to check recurrence on meetings I will set Recurrency to Custom - and I set the fields so that the meeting will occur weekly on Monday and Friday 10 times. -- - !python {model: crm.meeting}: | - self.write(cr, uid, [ref("crm_meeting_regardingpresentation0")], {'fr': 1, 'mo': 1, 'th': 1, 'tu': 1, 'we':1, 'count':10, 'interval': 1, 'rrule_type': 'weekly', 'recurrency' : True}) - -- | - I can see from the calendar view that the meeting is scheduled on Monday and Friday - for 10 times. - -- - !python {model: crm.meeting}: | - self.fields_view_get(cr, uid, False, 'calendar', context) -- | - I will search for one of the recurrent event and count the number of meeting. -- - !python {model: crm.meeting}: | - import time - from datetime import datetime, date, timedelta - ids = self.search(cr, uid, [('date', '>=', time.strftime('%Y-%m-%d 00:00:00')), ('date', '<=', (datetime.now()+timedelta(31)).strftime('%Y-%m-%d 00:00:00')), ('name', '=', 'Regarding Presentation')], context={'virtual_id': True}) - assert len(ids) == 10 - -- | - If I want to edit meetings information for all occurrence I click on "Edit All" button. -- - !python {model: crm.meeting}: | - self.write(cr, uid, [ref('crm_meeting_regardingpresentation0')], {'edit_all':'True'},context) -- | - I can see that new meeting form is opened with same value. - I change some data for meeting and save it. - I can see from meeting's calendar view that all meeting occurrences are changed accordingly. -- - !record {model: crm.meeting, id: crm.crm_meeting_regardingpresentation0}: - alarm_id: base_calendar.alarm9 - rrule_type: weekly - -- | - In order to invite people for this meetings, I click on "Invite People" button - I can invite internal user. -- - !record {model: base_calendar.invite.attendee, id: base_calendar_invite_attendee_0}: - type: internal - send_mail: False - partner_id: base.res_partner_9 - user_ids: - - base.user_demo -- - I click on "Invite" button of "Invite attendee" wizard. -- - !python {model: base_calendar.invite.attendee}: | - self.do_invite(cr, uid, [ref('base_calendar_invite_attendee_0')], {'active_id': ref('crm_meeting_regardingpresentation0'), 'model' : 'crm.meeting', 'attendee_field':'attendee_ids'}) - -- | - After direct/indirect confirmation for meetings I can confirm meeting. -- - !python {model: crm.meeting}: | - self.case_open(cr, uid, [ref('crm_meeting_regardingpresentation0')]) diff --git a/addons/crm/test/test_crm_opportunity.yml b/addons/crm/test/test_crm_opportunity.yml deleted file mode 100644 index 734a1cae46c..00000000000 --- a/addons/crm/test/test_crm_opportunity.yml +++ /dev/null @@ -1,113 +0,0 @@ -- | - I start by creating a new Opportunity. And I select partner for opportunity. - I can see that after selecting partner his contact and email is automatically filled. -- - !record {model: crm.lead, id: crm_opportunity_abcfuelcounits0}: - email_from: info@balmerinc.be - name: 'ABC FUEL CO 829264 - 10002 units' - partner_address_id: base.res_partner_address_1 - partner_id: base.res_partner_9 - probability: 1.0 - stage_id: crm.stage_lead1 - categ_id: crm.categ_oppor2 - section_id: crm.section_sales_department -- | - I check that the opportunity is in 'New' state. -- - !assert {model: crm.lead, id: crm_opportunity_abcfuelcounits0}: - - state == "draft" - -- | - I check that phonecall record is created for that opportunity. -- - !python {model: crm.phonecall}: | - phone_obj = self.pool.get('crm.phonecall') -- | - I schedule Meeting on this current opportunity by clicking on "schedule - Meeting". -- - !python {model: crm.lead}: | - self.action_makeMeeting(cr, uid, [ref("crm_opportunity_abcfuelcounits0")]) - -- | - I can see that Meeting's calendar view is shown. - then I click on the date on which I want to schedule meeting. - I fill proper data for that meeting and save it. -- - !record {model: crm.meeting, id: crm_meeting_abcfuelcounits0}: - date: !eval time.strftime('%Y-%m-%d 00:00:00') - date_deadline: !eval time.strftime('%Y-%m-%d 08:00:00') - duration: 8.0 - email_from: info@balmerinc.be - name: 'ABC FUEL CO 829264 - 10002 units' - opportunity_id: 'crm_opportunity_abcfuelcounits0' - partner_address_id: base.res_partner_address_1 - partner_id: base.res_partner_9 - section_id: crm.section_sales_department - state: open -- | - In order to schedule a phonecall to the partner - I click on "schedule call" button and select planned date for the call. -- - !record {model: crm.opportunity2phonecall, id: crm_opportunity2phonecall_abcfuelcounits0}: - date: !eval "(datetime.now() + timedelta(1)).strftime('%Y-%m-%d 11:15:00')" - name: 'ABC FUEL CO 829264 - 10002 units' - section_id: crm.section_sales_department - user_id: base.user_demo - categ_id: crm.categ_phone1 -- | - schedule phonecall by opportunity2phoncall wizard. -- - !python {model: crm.opportunity2phonecall}: | - self.action_apply(cr, uid, [ref('crm_opportunity2phonecall_abcfuelcounits0')], {'active_ids': [ref("crm_opportunity_abcfuelcounits0")]}) -- | - I check that phonecall record is created for that opportunity. -- - !python {model: crm.phonecall}: | - phone_obj = self.pool.get('crm.phonecall') - ids = phone_obj.search(cr, uid, [('name', '=', 'ABC FUEL CO 829264 - 10002 units')]) - assert len(ids) -- | - I can see phonecall record after click on "Schedule call" wizard. -- - !record {model: crm.phonecall, id: crm_phonecall_abcfuelcounits0}: - date: !eval "(datetime.now() + timedelta(1)).strftime('%Y-%m-%d 11:15:00')" - duration: 3.0 - name: 'ABC FUEL CO 829264 - 10002 units' - partner_address_id: base.res_partner_address_1 - partner_id: base.res_partner_9 - section_id: crm.section_sales_department -- | - I Merge the opportunities. -- - for that create two opportunities first opportunity 'Test FUEL CO'. -- - !record {model: crm.lead, id: crm_opportunity_1}: - email_from: info@balmerinc.be - name: 'Test FUEL CO 829264 - 10002 units' - partner_address_id: base.res_partner_address_1 - partner_id: base.res_partner_9 - probability: 1.0 - stage_id: crm.stage_lead1 - categ_id: crm.categ_oppor2 - section_id: crm.section_sales_department -- - I create the opportunity 'FUEL CO'. -- - !record {model: crm.lead, id: crm_opportunity_2}: - email_from: info@balmerinc.be - name: 'FUEL CO 829264 - 10002 units' - partner_address_id: base.res_partner_address_1 - partner_id: base.res_partner_9 - probability: 1.0 - stage_id: crm.stage_lead1 - categ_id: crm.categ_oppor2 - section_id: crm.section_sales_department -- | - I Merge two Opportunities. -- - !python {model: crm.merge.opportunity}: | - op_list = [ref('crm_opportunity_1'),ref('crm_opportunity_2')] - op_ids=self.pool.get('crm.lead').browse(cr,uid,op_list) - lead_ids = [ref('crm_lead_newcustomer0')] - self.merge(cr, uid, op_ids, {'lead_ids': lead_ids}) diff --git a/addons/crm/test/test_crm_opportunity_case2.yml b/addons/crm/test/test_crm_opportunity_case2.yml deleted file mode 100644 index dc0dbe517f1..00000000000 --- a/addons/crm/test/test_crm_opportunity_case2.yml +++ /dev/null @@ -1,45 +0,0 @@ -- | - I start by creating a new Opportunity. And I select partner for opportunity. - I can see that after selecting partner his contact and email is automatically filled. -- - !record {model: crm.lead, id: crm_opportunity_demotestopportunity}: - email_from: info@balmerinc.be - name: 'Demo Test Opportunity' - partner_address_id: base.res_partner_address_1 - partner_id: base.res_partner_9 - probability: 1.0 - categ_id: crm.categ_oppor2 - section_id: crm.section_sales_department - type: opportunity -- - I check that the opportunity is in 'New' state. -- - !assert {model: crm.lead, id: crm_opportunity_demotestopportunity, string: Opportunity in Draft}: - - state == "draft" -- - I open opportunity by click on "Open" button. -- - !python {model: crm.lead}: | - self.case_open(cr, uid, [ref("crm_opportunity_demotestopportunity")]) -- - I change partner of the opportunity. -- - !python {model: crm.lead}: | - self.onchange_partner_id(cr, uid, [ref("crm_opportunity_demotestopportunity")], ref("base.res_partner_agrolait")) - -- - I change Contact Detail of the opportunity. -- - !python {model: crm.lead}: | - self.onchange_partner_address_id(cr, uid,[ref("crm_opportunity_demotestopportunity")], ref("base.res_partner_address_8invoice")) - -- - I change Opportunity to Won State. -- - !python {model: crm.lead}: | - self.case_mark_won(cr, uid, [ref("crm_opportunity_demotestopportunity")]) -- - I check that the opportunity is in 'Done' state. -- - !assert {model: crm.lead, id: crm_opportunity_demotestopportunity, string: Opportunity is Won}: - - state == "done" diff --git a/addons/crm/test/test_crm_partner2opportunity.yml b/addons/crm/test/test_crm_partner2opportunity.yml deleted file mode 100644 index fe026074f4f..00000000000 --- a/addons/crm/test/test_crm_partner2opportunity.yml +++ /dev/null @@ -1,25 +0,0 @@ -- | - I start by creating a new opportunity from partner. -- - !record {model: crm.partner2opportunity, id: crm_partner2opportunity_id_0}: - name: test - planned_revenue: 0.0 - partner_id: base.res_partner_9 - probability: 0.0 -- - I click on "Create Opportunity" button of this wizard. -- - !python {model: crm.partner2opportunity}: | - fields = { - 'name': 'test', - 'planned_revenue': '0.0', - 'partner_id': ref('base.res_partner_9'), - 'probability': '0.0' - } - self.default_get(cr, uid, fields, {"active_ids": [ref("crm_partner2opportunity_id_0")]}) -- | - In order to check the opportunity is created or not, I check type. -- - !python {model: crm.partner2opportunity}: | - opportunity = self.make_opportunity(cr, uid, [ref("crm_partner2opportunity_id_0")], {"active_ids": [ref("crm_partner2opportunity_id_0")]}) - assert True diff --git a/addons/crm/test/test_crm_phonecall.yml b/addons/crm/test/test_crm_phonecall.yml deleted file mode 100644 index 0754a5b9544..00000000000 --- a/addons/crm/test/test_crm_phonecall.yml +++ /dev/null @@ -1,116 +0,0 @@ -- | - I start by creating a new phonecall. -- - !record {model: crm.phonecall, id: crm_phonecall_interviewcall0}: - date: !eval time.strftime('%Y-%m-%d 08:00:00') - name: Interview call - duration: 2.0 - section_id: crm.section_sales_department -- - I select partner by click on "Create a Partner" button. -- - !record {model: crm.phonecall2partner, id: crm_phonecall2partner_1}: - action: exist - partner_id: base.res_partner_9 - -- - I click on "Continue" button of this wizard and make partner. -- - !python {model: crm.phonecall2partner}: | - - self._select_partner(cr, uid,{"active_ids": [ref("crm_phonecall_interviewcall0")]}) - self.open_create_partner(cr, uid, [ref("crm_phonecall2partner_1")], {"active_ids": [ref("crm_phonecall_interviewcall0")]}) - self.make_partner(cr, uid, [ref("crm_phonecall2partner_1")], {"active_ids": [ref("crm_phonecall_interviewcall0")]}) - -- | - As the success of phonecall seems to be a real business opportunity, I will convert - it to opportunity by clicking on the "Convert to Opportunity" button. -- - !record {model: crm.phonecall2opportunity, id: crm_phonecall2opportunity_interviewcall0}: - name: Interview call - partner_id: base.res_partner_9 - planned_revenue: 0.0 - probability: 0.0 -- | - I can see that a business opportunity is now assigned to this phonecall -- - !assert {model: crm.phonecall, id: crm_phonecall_interviewcall0}: - - opportunity_id != False -- - I click on "Convert" button of this wizard. -- - !python {model: crm.phonecall2opportunity}: | - self.action_apply(cr, uid, [ref("crm_phonecall2opportunity_interviewcall0")], {"active_id": ref("crm_phonecall_interviewcall0")}) -- | - And I check that the phonecall and the newly created business opportunity is linked - to same partner. -- - !python {model: crm.phonecall}: | - obj_phonecall = self.browse(cr, uid, ref('crm_phonecall_interviewcall0')) - ids = self.pool.get('crm.lead').search(cr, uid, [('name', '=', obj_phonecall.opportunity_id.name)]) - obj_opp = self.pool.get('crm.lead').browse(cr, uid, ids)[0] - assert obj_phonecall.partner_id == obj_opp.partner_id -- | - I schedule Meeting on this current phonecall by clicking on "schedule - Meeting". -- - !python {model: crm.phonecall}: | - self.action_make_meeting(cr, uid, [ref('crm_phonecall_interviewcall0')]) - -- | - I can see that Meeting's calendar view is shown. - then I click on the date on which I want schedule meeting. - I fill proper data for that meeting and save it. -- - !record {model: crm.meeting, id: crm_meeting_interviewcall0}: - alarm_id: base_calendar.alarm3 - date: !eval "'%s-%s-%s 09:00:00' %(datetime.now().year,datetime.now().month,datetime.now().day)" - date_deadline: !eval "'%s-%s-%s 17:00:00' %(datetime.now().year,datetime.now().month,datetime.now().day)" - duration: 8.0 - email_from: info@balmerinc.be - name: Interview call - partner_address_id: base.res_partner_address_1 - partner_id: base.res_partner_9 - phonecall_id: 'crm_phonecall_interviewcall0' - state: open - -- | - In order to schedule other phonecall to the partner - I click on "schedule other call" button. and plan for other call - I can see that it will open other phonecall view with some data same as current - phonecall. -- - !record {model: crm.phonecall2phonecall, id: crm_phonecall2phonecall_interviewcall0}: - date: !eval "'%s-%s-%s 19:49:00' %(datetime.now().year,datetime.now().month,datetime.now().day)" - name: Interview call - section_id: crm.section_sales_department - user_id: base.user_root - action: schedule - categ_id: crm.categ_phone1 -- - I click on "schedule other call" button. and plan for other call. -- - !record {model: crm.phonecall2phonecall, id: crm_phonecall2phonecall_interviewcall1}: - date: !eval "'%s-%s-%s 19:49:00' %(datetime.now().year,datetime.now().month,datetime.now().day)" - name: Interview call - section_id: crm.section_sales_department - user_id: base.user_root - action: log - categ_id: crm.categ_phone1 -- | - I click on "Schedule" button of this wizard. -- - !python {model: crm.phonecall2phonecall}: | - fields = { - 'name': 'Interview call', - 'section_id': ref('crm.section_sales_department'), - 'user_id': ref('base.user_root'), - 'categ_id': ref('crm.categ_phone1') - } - self.default_get(cr, uid, fields,{'active_id': ref('crm_phonecall_interviewcall0')}) - self.action_apply(cr, uid, [ref('crm_phonecall2phonecall_interviewcall0')], {'active_id': ref('crm_phonecall_interviewcall0')}) -- | - I click on "Schedule" button of this wizard with log option. -- - !python {model: crm.phonecall2phonecall}: | - self.action_apply(cr, uid, [ref('crm_phonecall2phonecall_interviewcall1')], {'active_id': ref('crm_phonecall_interviewcall0')}) diff --git a/addons/crm/test/test_crm_phonecall_case2.yml b/addons/crm/test/test_crm_phonecall_case2.yml deleted file mode 100644 index 1b07121183c..00000000000 --- a/addons/crm/test/test_crm_phonecall_case2.yml +++ /dev/null @@ -1,26 +0,0 @@ -- | - I start by creating a new phonecall. -- - !record {model: crm.phonecall, id: crm_phonecall_dummycall}: - date: !eval time.strftime('%Y-%m-%d 08:00:00') - name: Dummy call - duration: 0.0 - section_id: crm.section_sales_department - partner_id: base.res_partner_agrolait - state: open -- - I change Contact Detail of the Partner. -- - !python {model: crm.phonecall}: | - self.onchange_partner_address_id(cr, uid,[ref("crm_phonecall_dummycall")], ref("base.res_partner_address_8invoice")) - -- - I setting Phone call to Held (Done). -- - !python {model: crm.phonecall}: | - self.case_close(cr, uid, [ref("crm_phonecall_dummycall")]) -- - I check that the hone call is in 'Held' state. -- - !assert {model: crm.phonecall, id: crm_phonecall_dummycall, string: Phone call Helded}: - - state == "done" diff --git a/addons/crm/test/test_crm_recurrent_meeting.yml b/addons/crm/test/test_crm_recurrent_meeting.yml deleted file mode 100644 index 297ca8d5e4e..00000000000 --- a/addons/crm/test/test_crm_recurrent_meeting.yml +++ /dev/null @@ -1,106 +0,0 @@ -- - In order to test recurrent meetings in OpenERP, I create meetings with different recurrency. -- - I create a customer meeting record with daily recurrency. -- - !record {model: crm.meeting, id: crm_meeting_pricelistdiscussion0}: - categ_id: crm.categ_meet1 - count: 0.0 - date: '2011-01-05 00:00:00' - date_deadline: '2011-01-05 01:00:00' - day: 0.0 - duration: 1.0 - end_date: '2011-01-12' - end_type: end_date - name: Pricelist Discussion - recurrency: true - recurrent_uid: 0.0 - rrule: FREQ=DAILY;INTERVAL=1;UNTIL=20110112T235959Z - rrule_type: daily - sequence: 0.0 -- - I create another meeting record with weekly recurrency. -- - !record {model: crm.meeting, id: crm_meeting_changesindesigning0}: - categ_id: crm.categ_meet2 - count: 15 - date: '2011-01-22 11:05:05' - date_deadline: '2011-01-22 16:05:05' - day: 0.0 - duration: 5.0 - email_from: info@opensides.be - end_type: count - fr: true - mo: true - name: Changes in Designing - partner_address_id: base.res_partner_address_1 - partner_id: base.res_partner_9 - recurrency: true - recurrent_uid: 0.0 - rrule: FREQ=WEEKLY;BYDAY=FR,TU,TH,WE,MO;INTERVAL=1;COUNT=15 - rrule_type: weekly - section_id: crm.section_sales_department - sequence: 0.0 - th: true - tu: true - user_id: base.user_demo - we: true -- - I create a meeting record with monthly recurrency. -- - !record {model: crm.meeting, id: crm_meeting_reviewneeds0}: - categ_id: crm.categ_meet3 - count: 0.0 - date: '2011-01-20 10:02:02' - date_deadline: '2011-01-20 16:02:02' - day: 15 - duration: 6.0 - end_date: '2011-05-31' - end_type: end_date - name: Review needs - partner_address_id: base.res_partner_address_15 - partner_id: base.res_partner_11 - recurrency: true - recurrent_uid: 0.0 - rrule: FREQ=MONTHLY;INTERVAL=1;UNTIL=20110531T235959Z;BYMONTHDAY=15 - rrule_type: monthly - section_id: crm.section_sales_department - sequence: 0.0 - user_id: base.user_demo -- - I create a record for daily scrum meeting. -- - !record {model: crm.meeting, id: crm_meeting_scrummeeting0}: - categ_id: crm.categ_meet2 - count: 0.0 - date: '2011-01-06 00:00:00' - date_deadline: '2011-01-06 01:00:00' - day: 0.0 - duration: 1.0 - name: Scrum meeting - recurrency: true - recurrent_uid: 0.0 - rrule: FREQ=DAILY;INTERVAL=1 - rrule_type: daily - sequence: 0.0 -- - I create a meeting record for yearly recurrency. -- - !record {model: crm.meeting, id: crm_meeting_updatethedata0}: - categ_id: crm.categ_meet2 - count: 0.0 - date: '2011-01-18 13:12:49' - date_deadline: '2011-01-19 02:30:49' - day: 0.0 - duration: 13.300000000000001 - end_date: '2015-01-06' - end_type: end_date - name: Update the data - partner_address_id: base.res_partner_address_7 - partner_id: base.res_partner_4 - recurrency: true - recurrent_uid: 0.0 - rrule: FREQ=YEARLY;INTERVAL=1;UNTIL=20150106T235959Z - rrule_type: yearly - section_id: crm.section_sales_department - sequence: 0.0 diff --git a/addons/crm/test/test_crm_recurrent_meeting_case2.yml b/addons/crm/test/test_crm_recurrent_meeting_case2.yml deleted file mode 100644 index b6afeb6906e..00000000000 --- a/addons/crm/test/test_crm_recurrent_meeting_case2.yml +++ /dev/null @@ -1,97 +0,0 @@ -- - In order to test recurrent meetings in OpenERP, I create meetings with different recurrency using different test cases. -- - I create a recurrent meeting with daily recurrency and fixed amount of time. -- - !record {model: crm.meeting, id: crm_meeting_testmeeting0}: - count: 5 - date: '2011-04-13 11:04:00' - date_deadline: '2011-04-13 12:04:00' - day: 0.0 - duration: 1.0 - name: Test Meeting - recurrency: true - recurrent_uid: 0.0 - rrule_type: daily - sequence: 0.0 -- - I search for all the recurrent meetings. -- - !python {model: crm.meeting}: | - meeting_ids = self.search(cr, uid, [('id', 'in', [ref('crm_meeting_testmeeting0')]),('date','>=','2011-03-13'), ('date_deadline', '<=', '2011-05-13')], context={'virtual_id': True}) - assert len(meeting_ids) == 5, 'Recurrent daily meetings are not created !' -- - I create a weekly meeting till a particular end date. -- - !record {model: crm.meeting, id: crm_meeting_reviewcodewithprogrammer0}: - date: '2011-04-18 11:47:00' - date_deadline: '2011-04-18 12:47:00' - day: 0.0 - duration: 1.0 - end_date: '2011-04-30' - end_type: end_date - fr: true - mo: true - th: true - tu: true - we: true - name: Review code with programmer - recurrency: true - recurrent_uid: 0.0 - rrule_type: weekly - sequence: 0.0 -- - I search for all the recurrent weekly meetings. -- - !python {model: crm.meeting}: | - meeting_ids = self.search(cr, uid, [('id', 'in', [ref('crm_meeting_reviewcodewithprogrammer0')]),('date','>=','2011-03-13'), ('date_deadline', '<=', '2011-05-13')], context={'virtual_id': True}) - assert len(meeting_ids) == 10, 'Recurrent weekly meetings are not created !' -- - I want to schedule a meeting every month for Sprint review. -- - !record {model: crm.meeting, id: crm_meeting_sprintreview0}: - count: 12 - date: '2011-04-01 12:01:00' - date_deadline: '2011-04-01 13:01:00' - day: 1 - duration: 1.0 - name: Sprint Review - recurrency: true - recurrent_uid: 0.0 - rrule_type: monthly - sequence: 0.0 -- - I search for all the recurrent monthly meetings. -- - !python {model: crm.meeting}: | - meeting_ids = self.search(cr, uid, [('id', 'in', [ref('crm_meeting_sprintreview0')]),('date','>=','2011-03-01'), ('date_deadline', '<=', '2012-05-13')], context={'virtual_id': True}) - assert len(meeting_ids) == 12, 'Recurrent monthly meetings are not created !' -- - I change name of my monthly Sprint Review meeting. -- - !python {model: crm.meeting}: | - from base_calendar import base_calendar - base_cal_id = base_calendar.real_id2base_calendar_id(ref('crm_meeting_sprintreview0'), '2011-09-01 13:01:00') - self.write(cr, uid, [base_cal_id], {'name': 'Sprint Review for google modules', 'edit_all': True}) -- - I check whether all the records are edited or not. -- - !python {model: crm.meeting}: | - meeting_ids = self.search(cr, uid, [('id', 'in', [ref('crm_meeting_sprintreview0')]),('date','>=','2011-03-01'), ('date_deadline', '<=', '2012-05-13')], context={'virtual_id': True}) - meetings = self.browse(cr, uid, meeting_ids, context) - for meeting in meetings: - assert meeting.name == 'Sprint Review for google modules', 'Name not changed for id: %s' %meeting.id -- - I change description of my weekly meeting Review code with programmer. -- - !python {model: crm.meeting}: | - from base_calendar import base_calendar - base_cal_id = base_calendar.real_id2base_calendar_id(ref('crm_meeting_reviewcodewithprogrammer0'), '2011-04-25 12:47:00') - self.write(cr, uid, [base_cal_id], {'description': 'Review code of the module: sync_google_calendar.'}) -- - I check whether the record is edited perfectly or not. -- - !python {model: crm.meeting}: | - meeting_ids = self.search(cr, uid, [('recurrent_uid', '=', ref('crm_meeting_reviewcodewithprogrammer0')), ('recurrent_id','=','2011-04-25 12:47:00')], context) - assert meeting_ids, 'Meeting is not edited !' - diff --git a/addons/crm/test/test_crm_segmentation.yml b/addons/crm/test/test_crm_segmentation.yml deleted file mode 100644 index 5563f1ce52f..00000000000 --- a/addons/crm/test/test_crm_segmentation.yml +++ /dev/null @@ -1,38 +0,0 @@ -- | - I will test segmentation which create specific partner categories criteria. -- - I create a new segmentation record. -- - !record {model: crm.segmentation, id: crm_segmentation_id_0}: - categ_id: base.res_partner_category_5 - exclusif: true - name: segment - som_interval: 0.0 - sales_purchase_active : True -- - I start the process. -- - !python {model: crm.segmentation}: | - self.process_start(cr, uid, [ref("crm_segmentation_id_0")],context) -- - I continue the segmentation process. -- - !python {model: crm.segmentation}: | - context.update({'start': True}) - self.process_continue(cr, uid, [ref("crm_segmentation_id_0")], context) -- - I create the segmentation line. -- - !record {model: crm.segmentation.line, id: crm_segmentation_line_id_0}: - expr_name: sale - expr_operator: '>' - expr_value: 1000.0 - name: Rule1 - operator: or - segmentation_id: crm_segmentation_id_0 - -- - I check the Segmentation line record. -- - !python {model: crm.segmentation.line}: | - self.test(cr, uid, [ref("crm_segmentation_line_id_0")],partner_id=0) diff --git a/addons/crm/test/test_crm_stage_changes.yml b/addons/crm/test/test_crm_stage_changes.yml deleted file mode 100644 index 391a328bffe..00000000000 --- a/addons/crm/test/test_crm_stage_changes.yml +++ /dev/null @@ -1,96 +0,0 @@ -- - In order to test the changes on stage of a lead or an opportunity with OpenERP, - I create some leads and test the stage changes. -- - I want to change the probability to 0.0 when the opportunity is marked as lost. - So I set its Change probability automatically true. -- - !record {model: crm.case.stage, id: crm.stage_lead6}: - name: Lost - on_change: true - probability: 0.0 - section_ids: - - crm.section_sales_department - sequence: 0 -- - I create a lead 'Test Lead1'. -- - !record {model: crm.lead, id: crm_lead_openerppresentation0}: - categ_id: crm.categ_oppor4 - day_close: 0.0 - day_open: 0.0 - name: Test Lead1 - planned_revenue: 0.0 - probability: 10.0 - section_id: crm.section_sales_department -- - I open the lead. -- - !python {model: crm.lead}: | - self.case_open(cr, uid, [ref('crm_lead_openerppresentation0')]) -- - I assigning stage. -- - !python {model: crm.lead}: | - self.onchange_stage_id(cr, uid, [ref('crm_lead_openerppresentation0')], [], context) -- - I assigning percent. -- - !python {model: crm.lead}: | - self.stage_find_percent(cr, uid, 10.0, []) -- - I find that this lead can be converted to opportunity. -- - !record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner0}: - action: 'create' - name: 'convert' -- - So I convert the lead to opportunity. -- - !python {model: crm.lead2opportunity.partner}: | - self.action_apply(cr, uid, [ref('crm_lead2opportunity_partner0')], context={'active_ids': [ref('crm_lead_openerppresentation0')]}) -- - I check that lead is now converted to opportunity. -- - !python {model: crm.lead}: | - lead = self.browse(cr, uid, ref('crm_lead_openerppresentation0')) - assert lead.type == 'opportunity', 'Lead is not converted to opportunity!' -- - I mark this opportunity as lost. -- - !python {model: crm.lead}: | - self.case_mark_lost(cr, uid, [ref('crm_lead_openerppresentation0')]) -- - I check whether the probability is set according to stage change or not. -- - !python {model: crm.lead}: | - opportunity = self.browse(cr, uid, ref('crm_lead_openerppresentation0')) - assert opportunity.stage_id.id == ref('crm.stage_lead6'), 'Stage is not changed!' - assert opportunity.probability == 0.0, 'Probability is wrong!' -- - I create one more opportunity. -- - !record {model: crm.lead, id: crm_lead_test2}: - name: Partner Demo - type: opportunity - categ_id: crm.categ_oppor3 - planned_revenue: 50000.0 - probability: 100.0 - section_id: crm.section_sales_department -- - I open this opportunity. -- - !python {model: crm.lead}: | - self.case_open(cr, uid, [ref('crm_lead_test2')]) -- - I mark this opportunity as won. -- - !python {model: crm.lead}: | - self.case_mark_won(cr, uid, [ref('crm_lead_test2')]) -- - I check whether the stage is changed to 'Won' and probability is 100.0 or not. -- - !python {model: crm.lead}: | - opportunity = self.browse(cr, uid, ref('crm_lead_test2')) - assert opportunity.stage_id.id == ref('crm.stage_lead5'), 'Stage is not changed!' - assert opportunity.probability == 100.0, 'Probability is wrong!' diff --git a/addons/crm/test/ui/crm_demo.yml b/addons/crm/test/ui/crm_demo.yml new file mode 100644 index 00000000000..5ef40838466 --- /dev/null +++ b/addons/crm/test/ui/crm_demo.yml @@ -0,0 +1,29 @@ +- + I create lead record to call of partner onchange, stage onchange and Mailing opt-in onchange method. +- + !record {model: crm.lead, id: crm_case_shelvehouse}: + name: 'Need more info about your pc2' + partner_id: base.res_partner_theshelvehouse0 + type: opportunity + stage_id: crm.stage_lead1 + state: draft + optin: True +- + I create lead record to call Mailing opt-out onchange method. +- + !record {model: crm.lead, id: crm_case_mediapoleunits0}: + name: 'Need 20 Days of Consultancy' + type: opportunity + state: draft + optout: True +- + I create phonecall record to call partner onchange method. +- + !record {model: crm.phonecall, id: crm_case_phone05}: + name: 'Bad time' + partner_id: base.res_partner_5 +- + I setting next stage "New" for the lead. +- + !python {model: crm.lead}: | + self.stage_next(cr, uid, [ref("crm_case_qrecorp0")], context={'stage_type': 'lead'}) diff --git a/addons/crm/test/ui/delete_lead.yml b/addons/crm/test/ui/delete_lead.yml new file mode 100644 index 00000000000..472b22d0d2d --- /dev/null +++ b/addons/crm/test/ui/delete_lead.yml @@ -0,0 +1,5 @@ +- + I Unlink the Lead. +- + !python {model: crm.lead}: | + self.unlink(cr, uid, [ref("crm_case_qrecorp0")]) diff --git a/addons/crm/test/ui/duplicate_lead.yml b/addons/crm/test/ui/duplicate_lead.yml new file mode 100644 index 00000000000..6b349ca350c --- /dev/null +++ b/addons/crm/test/ui/duplicate_lead.yml @@ -0,0 +1,5 @@ +- + I make duplicate the Lead. +- + !python {model: crm.lead}: | + self.copy(cr, uid, ref("crm_case_qrecorp0")) |
