[MERGE] crm: improve test coverage
bzr revid: rco@openerp.com-20111220095750-55q5zwz8x6uzcx35
This commit is contained in:
commit
16f3e156e0
|
@ -123,6 +123,7 @@ Creates a dashboard for CRM that includes:
|
|||
'test/process/lead2opportunity2win.yml',
|
||||
'test/process/merge_opportunity.yml',
|
||||
'test/process/cancel_lead.yml',
|
||||
'test/process/action_rule.yml',
|
||||
'test/process/segmentation.yml',
|
||||
'test/ui/crm_demo.yml',
|
||||
'test/ui/duplicate_lead.yml',
|
||||
|
|
|
@ -125,7 +125,7 @@ class base_action_rule(osv.osv):
|
|||
"""Gets available states for crm"""
|
||||
res = super(base_action_rule, self).state_get(cr, uid, context=context)
|
||||
return res + crm.AVAILABLE_STATES
|
||||
|
||||
# Dead Code
|
||||
def priority_get(self, cr, uid, context=None):
|
||||
res = super(base_action_rule, self).priority_get(cr, uid, context=context)
|
||||
return res + crm.AVAILABLE_PRIORITIES
|
||||
|
|
|
@ -118,7 +118,7 @@ class crm_phonecall(crm_base, osv.osv):
|
|||
"""Resets case as Todo
|
||||
"""
|
||||
res = super(crm_phonecall, self).case_reset(cr, uid, ids, args, 'crm.phonecall')
|
||||
self.write(cr, uid, ids, {'duration': 0.0})
|
||||
self.write(cr, uid, ids, {'duration': 0.0, 'state':'open'})
|
||||
return res
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
-
|
||||
I create a record rule.
|
||||
-
|
||||
!python {model: base.action.rule}: |
|
||||
modle_id = self.pool.get("ir.model").search(cr, uid, [('name', '=', 'crm.lead')])
|
||||
from datetime import datetime
|
||||
new_id = self.create(cr, uid, {'name': 'New Rule', 'model_id': modle_id[0], 'trg_user_id': ref('base.user_root'), 'trg_partner_id': ref('base.res_partner_asus'), 'act_user_id': ref('base.user_demo') })
|
||||
lead_obj = self.pool.get("crm.lead")
|
||||
self._check(cr, uid)
|
||||
-
|
||||
I create new lead to check record rule.
|
||||
-
|
||||
!record {model: crm.lead, id: crm_lead_test_rules_id}:
|
||||
name: 'Test lead rules'
|
||||
user_id: base.user_root
|
||||
partner_id: base.res_partner_asus
|
||||
-
|
||||
I check record rule is apply and responsible is changed.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
lead_user = self.browse(cr, uid, ref('crm_lead_test_rules_id'))
|
||||
assert lead_user.user_id.id == ref('base.user_demo'), "Responsible of lead is not changed."
|
|
@ -29,12 +29,12 @@
|
|||
!assert {model: crm.lead, id: crm.crm_case_itisatelesalescampaign0, string: Lead is in pending state}:
|
||||
- state == "pending"
|
||||
-
|
||||
I Escalate the Lead to Parent Team.
|
||||
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.
|
||||
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"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
-
|
||||
Customer interested in our product. so He send request by email to get more details.
|
||||
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
|
||||
-
|
||||
|
@ -41,10 +41,12 @@
|
|||
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.
|
||||
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)
|
||||
!python {model: crm.phonecall2partner}: |
|
||||
context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")], 'active_id': ref("crm.crm_case_phone06")})
|
||||
new_id = self.create(cr, uid, {}, context=context)
|
||||
self.make_partner(cr, uid, [new_id], context=context)
|
||||
-
|
||||
I check converted phonecall to partner.
|
||||
-
|
||||
|
|
|
@ -6,10 +6,18 @@
|
|||
!python {model: crm.lead}: |
|
||||
self.case_open(cr, uid, [ref("crm_case_qrecorp0")])
|
||||
-
|
||||
I check lead state is "Open".
|
||||
I check lead state is "Open".
|
||||
-
|
||||
!assert {model: crm.lead, id: crm.crm_case_qrecorp0, string: Lead in open state}:
|
||||
- state == "open"
|
||||
-
|
||||
I create partner from lead.
|
||||
-
|
||||
!record {model: crm.lead2partner, id: crm_lead2partner_id1, context: '{"active_model": "crm.lead", "active_ids": [ref("crm_case_qrecorp0")]}'}:
|
||||
-
|
||||
!python {model: crm.lead2partner}: |
|
||||
context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_qrecorp0')], 'active_id': ref('crm_case_qrecorp0')})
|
||||
self.make_partner(cr, uid ,[ref("crm_lead2partner_id1")], context=context)
|
||||
-
|
||||
I convert lead into opportunity for exiting customer.
|
||||
-
|
||||
|
@ -39,13 +47,13 @@
|
|||
ids = self.search(cr, uid, [('opportunity_id', '=', ref('crm_case_qrecorp0'))])
|
||||
assert len(ids), 'phonecall is not scheduled'
|
||||
-
|
||||
Now I schedule Meeting with Customer.
|
||||
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.
|
||||
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')})
|
||||
|
@ -57,7 +65,7 @@
|
|||
!python {model: crm.lead}: |
|
||||
self.case_mark_won(cr, uid, [ref("crm_case_qrecorp0")])
|
||||
-
|
||||
I check details of the opportunity After won the opportunity.
|
||||
I check details of the opportunity after won the opportunity.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
lead = self.browse(cr, uid, ref('crm_case_qrecorp0'))
|
||||
|
@ -72,7 +80,7 @@
|
|||
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.
|
||||
Now I check first lead converted on opportunity.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
opp = self.browse(cr, uid, ref('crm_case_employee0'))
|
||||
|
@ -81,10 +89,22 @@
|
|||
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.
|
||||
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!'
|
||||
assert opp.stage_id.id == ref("stage_lead1"), 'Stage of probability is incorrect!'
|
||||
-
|
||||
I confirm review needs meeting.
|
||||
-
|
||||
!python {model: crm.meeting}: |
|
||||
context.update({'active_model': 'crm.meeting'})
|
||||
self.case_open(cr, uid, [ref('crm.crm_case_reviewneeds0')])
|
||||
-
|
||||
I invite a user for meeting.
|
||||
-
|
||||
!python {model: calendar.attendee}: |
|
||||
meeting_id = self.create(cr, uid, {'user_id': ref('base.user_root'), 'email': 'user@meeting.com' })
|
||||
self.do_accept(cr, uid, [meeting_id])
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
-
|
||||
I make direct opportunity for Customer.
|
||||
I make direct opportunity for customer.
|
||||
-
|
||||
!python {model: crm.partner2opportunity}: |
|
||||
context.update({'active_model': 'res.partner', 'active_ids': [ref("base.res_partner_9")]})
|
||||
|
@ -13,13 +13,18 @@
|
|||
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.
|
||||
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)
|
||||
context.update({'active_model': 'crm.lead', 'active_ids': opportunity_ids, 'active_id': opportunity_ids[0]})
|
||||
-
|
||||
I check for merged opportunities for customer.
|
||||
!record {model: crm.merge.opportunity, id: opportunity_merge_id }:
|
||||
-
|
||||
!python {model: crm.merge.opportunity}: |
|
||||
self.action_merge(cr, uid, [ref("opportunity_merge_id")], 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"))])
|
||||
|
@ -31,21 +36,51 @@
|
|||
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")]})
|
||||
context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")], 'active_id': 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.
|
||||
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).
|
||||
I set phone call to not held.
|
||||
-
|
||||
!python {model: crm.phonecall}: |
|
||||
self.case_pending(cr, uid, [ref("crm.crm_case_phone06")])
|
||||
-
|
||||
I check that the phone call is in 'Not Held' state.
|
||||
-
|
||||
!assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call held.}:
|
||||
- state == "pending"
|
||||
-
|
||||
I cancelled the phone call.
|
||||
-
|
||||
!python {model: crm.phonecall}: |
|
||||
self.case_cancel(cr, uid, [ref("crm.crm_case_phone06")])
|
||||
-
|
||||
I check that the phone call is in 'Cancelled' state.
|
||||
-
|
||||
!assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call is not cancelled.}:
|
||||
- state == "cancel"
|
||||
-
|
||||
I reset the phone call.
|
||||
-
|
||||
!python {model: crm.phonecall}: |
|
||||
self.case_reset(cr, uid, [ref("crm.crm_case_phone06")])
|
||||
-
|
||||
I check that the phone call is reset or not.
|
||||
-
|
||||
!assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call is not reset.}:
|
||||
- state == "open"
|
||||
-
|
||||
I set 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}:
|
||||
!assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call is not held.}:
|
||||
- state == "done"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#Todo: Need to check after segmentation started
|
||||
|
||||
-
|
||||
I create rule Segmentation line record for partner .
|
||||
I create rule segmentation line record for partner .
|
||||
-
|
||||
!python {model: crm.segmentation.line}: |
|
||||
id = self.create(cr, uid, {'name': "OpenERP partners",'expr_value': 25})
|
||||
|
|
Loading…
Reference in New Issue