[ADD] crm - added test case for crm lead missing funcnality
[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 -  |
27    Creating a new lead "Demo Customer" and I provide an address to this
28    demo customer and email "info@democustomer.com" and Also "Demo Sales Team".
29 -
30    !record {model: crm.lead, id: crm_lead_democustomer}:
31      email_from: info@democustomer.com
32      name: Demo Customer
33      partner_name: NotSoTinySARL
34      phone: (+32).81.81.37.00
35      mobile: (+32).81.81.37.00
36      section_id: crm_case_section_demosalesteam
37      referred: False
38      type: lead
39 -
40    I check that the lead is in 'draft' state,
41 -
42    !assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in Draft}:
43      - state == "draft"
44 -
45   I assigning contact detail to the Lead "Demo Customer".
46 -
47   !python {model: crm.lead}: |
48     self.onchange_partner_address_id(cr, uid, ref("crm_lead_democustomer"), ref("base.res_partner_address_notsotinysarl0"), email=False)
49
50 -
51   I selecting email "Opt-out" option for the "Demo Customer" Lead.
52 -
53   !python {model: crm.lead}: |
54     self.on_change_optout(cr, uid, ref("crm_lead_democustomer"), True)
55
56 -
57   Now I change the Opt-out to Opt-in to show email receive preference.
58 -
59   !python {model: crm.lead}: |
60     self.on_change_optin(cr, uid, ref("crm_lead_democustomer"), True)
61 -
62    I open lead by click on "Open" button,
63 -
64    !python {model: crm.lead}: |
65      self.case_open(cr, uid, [ref("crm_lead_democustomer")])
66 -
67   I check that lead "Demo Customer" is now in 'open' state.
68 -
69   !assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in open state}:
70      - state == "open"
71 -
72   Now i reset the lead "Demo Customer".
73 -
74     !python {model: crm.lead}: |
75       self.case_reset(cr, uid, [ref("crm_lead_democustomer")])
76 -
77    I again opening lead by click on "Open" button,
78 -
79    !python {model: crm.lead}: |
80      self.case_open(cr, uid, [ref("crm_lead_democustomer")])
81 -
82   I setting stage "New" for the lead "Demo Customer".
83 -
84    !python {model: crm.lead}: |
85      self.stage_next(cr, uid, [ref("crm_lead_democustomer")], context={'stage_type': 'lead'})
86 -
87   I try to Unlink the Lead "Demo Customer" demo Lead
88 -
89    !python {model: crm.lead}: |
90     try:
91       self.unlink(cr, uid, [ref("crm_lead_democustomer")])
92     except:
93       pass
94 -
95    I setting Lead "Demo Customer" to Pending State
96 -
97     !python {model: crm.lead}: |
98       self.case_pending(cr, uid, [ref("crm_lead_democustomer")])
99 -
100   I check that lead "Demo Customer" is now in 'Pending' state.
101 -
102   !assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in Pending state}:
103      - state == "pending"
104 -
105   Now i Escalate the Lead "Demo Customer" Parent "Sales Team".
106 -
107     !python {model: crm.lead}: |
108       self.case_escalate(cr, uid, [ref("crm_lead_democustomer")])
109 -
110   Now i Copying this lead "Demo Customer" to New Lead.
111 -
112     !python {model: crm.lead}: |
113       self.copy(cr, uid, ref("crm_lead_democustomer"))
114 -
115   Checking the Lead Copied or Not.
116 -
117     !python {model: crm.lead}: |
118       sid = self.search(cr, uid, [('name', '=', 'Demo Customer'),('state', '=', 'draft')])
119       if not sid:
120         raise AssertionError("Lead is not copied Successfully")
121