[merge]
[odoo/odoo.git] / addons / crm / test / test_crm_lead.yml
1 -  |
2    In order to test the CRM in OpenERP, 
3    I will do a customer qualification process that
4    starts with a fist contact with a customer (a lead), which will be converted to a
5    business opportunity and a partner.
6 -  |
7    In order to test the flow, I create a two new users "user_crm" and
8    I assign the group "salesman".
9
10    !record {model: res.users, id: res_users_usercrm0}:
11      company_id: base.main_company
12      context_lang: en_US
13      context_section_id: crm.section_sales_department
14      groups_id:
15        - crm.group_crm_user
16      login: user_crm
17      name: user_crm
18      password: user_crm
19   
20 -  |
21    I start by creating a new lead "New Customer" and I provide an address to this
22    new customer, as well as an email "info@mycustomer.com".
23
24    !record {model: crm.lead, id: crm_lead_newcustomer0}:
25      email_from: info@mycustomer.com
26      name: New Customer
27      partner_name: Capegemini
28      phone: (855) 924-4364
29      mobile: (333) 715-1450
30      section_id: crm.section_sales_department
31      referred: False
32 -  |
33    I check that the lead is in 'draft' state, 
34 -    
35    !assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in Draft}:
36      - state == "draft"
37 -
38    I open lead by click on "Open" button,
39 -   
40    !python {model: crm.lead}: |
41      self.case_open(cr, uid, [ref("crm_lead_newcustomer0")])
42 - |
43   I check that lead is now in 'open' state.
44 -
45   !assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in open state}:
46      - state == "open"  
47        
48 -  |
49    As the lead seems to be a real business opportunity, I will convert it to a
50    partner 
51    and a business opportunity by clicking on the "Convert" button.
52 -  
53    !python {model: crm.lead}: |
54      lead = self.browse(cr, uid, ref('crm_lead_newcustomer0'))
55      action = self.convert_opportunity(cr, uid, [ref("crm_lead_newcustomer0")], {'active_ids': [ref("crm_lead_newcustomer0")]})
56      assert action['res_model'] == 'crm.lead2opportunity.partner'
57 -
58    |
59    Now, select "create a new partner" option in this wizard.
60 -
61    !record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_create_0}:
62       action: 'create'
63 -
64    I click on "Continue" button of this wizard.
65 -
66    !python {model: crm.lead2opportunity.partner}: |
67       self.make_partner(cr, uid, [ref("crm_lead2opportunity_partner_create_0")], {'active_ids': [ref("crm_lead_newcustomer0")]})
68 -
69   Now, I give value to this wizard field.     
70 -
71   !record {model: crm.lead2opportunity, id: crm_lead2opportunity_stonage_0}: 
72       name:  Capegemini
73       planned_revenue: 0.00
74       probability: 0.00
75 -
76   Then, Click on "Create Opportunity" button of this wizard.
77 -      
78   !python {model: crm.lead2opportunity}: |
79      self.action_apply(cr, uid, [ref('crm_lead2opportunity_stonage_0')], {'active_id': ref('crm_lead_newcustomer0')})
80
81 -  |   
82    I can check that a lead and a business opportunity is now assigned to this
83    lead.
84 #-
85 #   !python {model: crm.lead, id: crm_lead_newcustomer0}: 
86 #     - opportunity_id == False
87          
88 -  |
89    I check that the partner associated to this lead as the same country, phone number
90    and name than the opportunity.
91 -  
92   !python {model: crm.lead}: |
93     lead = self.browse(cr, uid, ref("crm_lead_newcustomer0"))
94     obj_opportunity = self.pool.get('crm.lead')
95     ids = obj_opportunity.search(cr, uid, [('name', '=', lead.partner_name)])
96     opportunity = obj_opportunity.browse(cr, uid, ids)[0]
97     assert lead.partner_name == opportunity.partner_id.name
98     assert lead.phone == opportunity.phone
99
100 #-
101 #  |
102 #  yaml is also not working  smpt server and send new email.
103
104 - |
105   I configure with smtp server.
106 - |
107   And I communicate with lead through send New mail to Lead using it email address from user which are loged.
108 - |
109   I check that communication history generated when send email to lead.
110 - |
111   Then,  I add a cc which receive copy of future communication between partner and users by mail.
112
113 - |
114   I Reply to last Email to lead with some document attached.and check that communication history generated or not.
115
116