38 lines
1.5 KiB
YAML
38 lines
1.5 KiB
YAML
-
|
|
In order to test find nearest Partner functionality and assign to opportunity ,
|
|
-
|
|
I Set Geo Lattitude and Longitude according to partner address.
|
|
-
|
|
!python {model: res.partner}: |
|
|
self.geo_localize(cr, uid, [ref('base.res_partner_2')], context)
|
|
-
|
|
I check Geo Latitude and Longitude of partner after set
|
|
-
|
|
!python {model: res.partner}: |
|
|
partner = self.browse(cr, uid, ref('base.res_partner_2'))
|
|
assert 50 < partner.partner_latitude < 51 , "Latitude is wrong"
|
|
assert 3 < partner.partner_longitude < 5 , "Longitude is wrong"
|
|
-
|
|
I assign nearest partner to opportunity.
|
|
-
|
|
!python {model: crm.lead}: |
|
|
self.assign_partner(cr, uid, [ref('crm.crm_case_19')], context=context)
|
|
-
|
|
I check assigned partner of opportunity who is nearest Geo Latitude and Longitude of opportunity.
|
|
-
|
|
!python {model: crm.lead}: |
|
|
lead = self.browse(cr, uid, ref('crm.crm_case_19'))
|
|
assert lead.partner_assigned_id.id == ref('base.res_partner_15') , "Opportuniy is not assigned nearest partner"
|
|
assert 50 < lead.partner_latitude < 55 , "Latitude is wrong"
|
|
assert -5 < lead.partner_longitude < 0, "Longitude is wrong"
|
|
-
|
|
I forward this opportunity to its nearest partner.
|
|
-
|
|
!python {model: crm.lead.forward.to.partner}: |
|
|
context.update({'active_model': 'crm.lead', 'active_id': ref('crm.crm_case_19'), 'active_ids': [ref('crm.crm_case_19')]})
|
|
forward_id = self.create(cr, uid, {'email_from': 'test@openerp.com', 'send_to': 'partner'}, context=context)
|
|
try:
|
|
self.action_forward(cr, uid, [forward_id], context=context)
|
|
except:
|
|
pass
|