[Merge]crm : Improve the test case for merging the opp.
[odoo/odoo.git] / addons / crm / test / test_crm_lead_case2.yml
1 -
2    In order to do complete test the CRM in OpenERP,
3    I will create new full configured record and carry test on it.
4 -  |
5    I Start by creating "Demo Sales Team" with No Unlink.
6    Creating a crm.case.section record
7 -
8   !record {model: crm.case.section, id: crm_case_section_demosalesteam}:
9     code: DEMO
10     complete_name: Demo Sales Team
11     name: Demo Sales Team
12     allow_unlink: False
13     member_ids:
14       - base.user_admin
15     stage_ids:
16       - crm.stage_lead1
17       - crm.stage_lead2
18       - crm.stage_lead3
19       - crm.stage_lead4
20       - crm.stage_lead5
21       - crm.stage_lead6
22     working_hours: 0.0
23     resource_calendar_id: resource.timesheet_group1
24     parent_id: crm.section_sales_department
25 -
26    !record {model: res.users, id: res_users_usercrm0}:
27      context_section_id: crm_case_section_demosalesteam    
28 -  |
29    Creating a new lead "Demo Customer" and I provide an address to this
30    demo customer and email "info@democustomer.com" and Also "Demo Sales Team".
31 -
32    !record {model: crm.lead, id: crm_lead_democustomer}:
33      email_from: info@democustomer.com
34      name: Demo Customer
35      partner_name: NotSoTinySARL
36      phone: (+32).81.81.37.00
37      mobile: (+32).81.81.37.00
38      section_id: crm_case_section_demosalesteam
39      referred: False
40      type: lead
41 -
42    I check that the lead is in 'draft' state,
43 -
44    !assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in Draft}:
45      - state == "draft"
46 -
47   I assigning contact detail to the Lead "Demo Customer".
48 -
49   !python {model: crm.lead}: |
50     self.onchange_partner_address_id(cr, uid, ref("crm_lead_democustomer"), ref("base.res_partner_address_notsotinysarl0"), email=False)
51
52 -
53   I selecting email "Opt-out" option for the "Demo Customer" Lead.
54 -
55   !python {model: crm.lead}: |
56     self.on_change_optout(cr, uid, ref("crm_lead_democustomer"), True)
57
58 -
59   Now I change the Opt-out to Opt-in to show email receive preference.
60 -
61   !python {model: crm.lead}: |
62     self.on_change_optin(cr, uid, ref("crm_lead_democustomer"), True)
63 -
64    I open lead by click on "Open" button,
65 -
66    !python {model: crm.lead}: |
67      self.case_open(cr, uid, [ref("crm_lead_democustomer")])
68 -
69   I check that lead "Demo Customer" is now in 'open' state.
70 -
71   !assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in open state}:
72      - state == "open"
73 -
74   Now i reset the lead "Demo Customer".
75 -
76     !python {model: crm.lead}: |
77       self.case_reset(cr, uid, [ref("crm_lead_democustomer")])
78 -
79    I again opening lead by click on "Open" button,
80 -
81    !python {model: crm.lead}: |
82      self.case_open(cr, uid, [ref("crm_lead_democustomer")])
83 -
84   I setting stage "New" for the lead "Demo Customer".
85 -
86    !python {model: crm.lead}: |
87      self.stage_next(cr, uid, [ref("crm_lead_democustomer")], context={'stage_type': 'lead'})
88 -
89   I try to Unlink the Lead "Demo Customer" demo Lead
90 -
91    !python {model: crm.lead}: |
92     try:
93       self.unlink(cr, uid, [ref("crm_lead_democustomer")])
94     except:
95       pass
96 -
97    I setting Lead "Demo Customer" to Pending State
98 -
99     !python {model: crm.lead}: |
100       self.case_pending(cr, uid, [ref("crm_lead_democustomer")])
101 -
102   I check that lead "Demo Customer" is now in 'Pending' state.
103 -
104   !assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in Pending state}:
105      - state == "pending"
106 -
107   Now i Escalate the Lead "Demo Customer" Parent "Sales Team".
108 -
109     !python {model: crm.lead}: |
110       self.case_escalate(cr, uid, [ref("crm_lead_democustomer")])
111
112   Now i add Internal Note Saying Escalated Reason
113   Creating a crm.add.note record
114
115   !record {model: crm.add.note, id: crm_add_note_0}:
116     body: Sales Lead Has Been Escalated Due to Some Technical reason to the parent  'Sales
117       Team'
118     state: unchanged
119 -
120   I click aa note button to attach the record
121
122   !python {model: crm.add.note}: |
123     context['active_model'] = "crm.lead"
124     context['active_ids'] = [ref("crm_lead_democustomer")]
125     self.action_add(cr, uid, [ref("crm_add_note_0")], context=context)
126
127 -
128   Now i Copying this lead "Demo Customer" to New Lead.
129 -
130     !python {model: crm.lead}: |
131       self.copy(cr, uid, ref("crm_lead_democustomer"))
132 -
133   Checking the Lead Copied or Not.
134 -
135     !python {model: crm.lead}: |
136       sid = self.search(cr, uid, [('name', '=', 'Demo Customer'),('state', '=', 'draft')])
137       if not sid:
138         raise AssertionError("Lead is not copied Successfully")
139