odoo/addons/crm/test/test_crm_lead_case2.yml

152 lines
4.7 KiB
YAML

-
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 "Demo 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: Demo Sales Team
name: Demo 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 "Demo Customer" and I provide an address to this
demo customer and email "info@democustomer.com" and Also "Demo Sales Team".
-
!record {model: crm.lead, id: crm_lead_democustomer}:
email_from: info@democustomer.com
name: Demo 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 "Demo 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 "Demo 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 "Demo 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 "Demo 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 "Demo 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 "Demo Customer".
-
!python {model: crm.lead}: |
self.stage_next(cr, uid, [ref("crm_lead_democustomer")], context={'stage_type': 'lead'})
-
I try to Unlink the Lead "Demo Customer" demo Lead.
-
!python {model: crm.lead}: |
try:
self.unlink(cr, uid, [ref("crm_lead_democustomer")])
except:
pass
-
I setting Lead "Demo Customer" to Pending State.
-
!python {model: crm.lead}: |
self.case_pending(cr, uid, [ref("crm_lead_democustomer")])
-
I check that lead "Demo 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 "Demo 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 "Demo 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', '=', 'Demo Customer'),('state', '=', 'draft')])
if not sid:
raise AssertionError("Lead is not copied Successfully")