[FIX] crm_partner_assign: geolocalization was bad for large countries e.g. US or Russia

Add one more step considering a slightly larger
range around the lead within the same country,
before considering the whole country at once.
Courtesy of Dhara Shah

bzr revid: odo@openerp.com-20120309020415-f7jg21ud1lu2l61f
This commit is contained in:
Olivier Dony 2012-03-09 03:04:15 +01:00
parent 84e927120c
commit 4ecac7d5b4
1 changed files with 8 additions and 0 deletions

View File

@ -211,6 +211,14 @@ class crm_lead(osv.osv):
('country', '=', lead.country_id.id),
], context=context)
# 3. third way: in the same country, extra large area
if not partner_ids:
partner_ids = res_partner.search(cr, uid, [
('partner_weight','>', 0),
('partner_latitude','>', latitude - 8), ('partner_latitude','<', latitude + 8),
('partner_longitude','>', longitude - 8), ('partner_longitude','<', longitude + 8),
('country', '=', lead.country_id.id),
], context=context)
# 5. fifth way: anywhere in same country
if not partner_ids: