2 I make direct opportunity for customer.
4 !python {model: crm.partner2opportunity}: |
5 context.update({'active_model': 'res.partner', 'active_ids': [ref("base.res_partner_9")]})
6 res_id = self.create(cr, uid, {'name': "enquête pour l'achat de services"}, context=context)
7 self.make_opportunity(cr, uid, [res_id], context=context)
9 I make another opportunity from phonecall for same customer.
11 !python {model: crm.phonecall2opportunity}: |
12 context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")]})
13 res_id = self.create(cr, uid, {'name': "Quoi de prix de votre autre service?", 'partner_id': ref("base.res_partner_9")}, context=context)
14 self.make_opportunity(cr, uid, [res_id], context=context)
16 Now I merge all opportunities of customer.
18 !python {model: crm.lead}: |
19 opportunity_ids = self.search(cr, uid, [('partner_id','=', ref("base.res_partner_9"))])
20 context.update({'active_model': 'crm.lead', 'active_ids': opportunity_ids, 'active_id': opportunity_ids[0]})
22 !record {model: crm.merge.opportunity, id: opportunity_merge_id }:
24 !python {model: crm.merge.opportunity}: |
25 self.action_merge(cr, uid, [ref("opportunity_merge_id")], context=context)
27 I check for merged opportunities for customer.
29 !python {model: crm.lead}: |
30 merge_id = self.search(cr, uid, [('partner_id','=', ref("base.res_partner_9"))])
31 assert merge_id, 'Fail to create Merge opportunity'
32 merge_data = self.browse(cr, uid, merge_id)[0]
33 assert merge_data.type == 'opportunity', 'Merged opportunity type not change!'
34 assert merge_data.partner_id.id == ref("base.res_partner_9"), 'Partner missmatch!'
36 Now I schedule another phonecall to customer after merged.
38 !python {model: crm.phonecall2phonecall}: |
39 context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")], 'active_id': ref("crm.crm_case_phone06")})
40 res_id = self.create(cr, uid, {'name': "vos chances sont fusionnés en un seul"}, context=context)
41 self.action_schedule(cr, uid, [res_id], context=context)
43 I schedule meeting on this phonecall.
45 !python {model: crm.phonecall}: |
46 self.action_make_meeting(cr, uid, [ref("crm.crm_case_phone06")])
48 I set phone call to not held.
50 !python {model: crm.phonecall}: |
51 self.case_pending(cr, uid, [ref("crm.crm_case_phone06")])
53 I check that the phone call is in 'Not Held' state.
55 !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call held.}:
58 I cancelled the phone call.
60 !python {model: crm.phonecall}: |
61 self.case_cancel(cr, uid, [ref("crm.crm_case_phone06")])
63 I check that the phone call is in 'Cancelled' state.
65 !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call is not cancelled.}:
68 I reset the phone call.
70 !python {model: crm.phonecall}: |
71 self.case_reset(cr, uid, [ref("crm.crm_case_phone06")])
73 I check that the phone call is reset or not.
75 !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call is not reset.}:
78 I set phone call to held (done).
80 !python {model: crm.phonecall}: |
81 self.case_close(cr, uid, [ref("crm.crm_case_phone06")])
83 I check that the phone call is in 'Held' state.
85 !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call is not held.}: