From 32041be9a1c8933c97458b221a3bf2cb57b1560b Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 5 Nov 2013 18:00:28 +0100 Subject: [PATCH] [FIX]crm_partner_assign: wizard forward to partner do not retry to geolocate again if the lead is already geolocated, because Google Geocode API has a query limit (2500/day, date of today), and for improving speed bzr revid: dle@openerp.com-20131105170028-gc0az6ppitnp33yc --- addons/crm_partner_assign/crm_partner_assign.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/crm_partner_assign/crm_partner_assign.py b/addons/crm_partner_assign/crm_partner_assign.py index 5b09aa9029f..c5329696b32 100644 --- a/addons/crm_partner_assign/crm_partner_assign.py +++ b/addons/crm_partner_assign/crm_partner_assign.py @@ -187,17 +187,19 @@ class crm_lead(osv.osv): return True # Don't pass context to browse()! We need country name in english below for lead in self.browse(cr, uid, ids): - result = None + if lead.partner_latitude and lead.partner_longitude: + continue if lead.country_id: result = geo_find(geo_query_address(street=lead.street, zip=lead.zip, city=lead.city, state=lead.state_id.name, country=lead.country_id.name)) - self.write(cr, uid, [lead.id], { - 'partner_latitude': result and result[0] or False, - 'partner_longitude': result and result[1] or False - }, context=context) + if result: + self.write(cr, uid, [lead.id], { + 'partner_latitude': result[0], + 'partner_longitude': result[1] + }, context=context) return True def search_geo_partner(self, cr, uid, ids, context=None):