[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
This commit is contained in:
parent
aabbb0b1c3
commit
32041be9a1
|
@ -187,17 +187,19 @@ class crm_lead(osv.osv):
|
||||||
return True
|
return True
|
||||||
# Don't pass context to browse()! We need country name in english below
|
# Don't pass context to browse()! We need country name in english below
|
||||||
for lead in self.browse(cr, uid, ids):
|
for lead in self.browse(cr, uid, ids):
|
||||||
result = None
|
if lead.partner_latitude and lead.partner_longitude:
|
||||||
|
continue
|
||||||
if lead.country_id:
|
if lead.country_id:
|
||||||
result = geo_find(geo_query_address(street=lead.street,
|
result = geo_find(geo_query_address(street=lead.street,
|
||||||
zip=lead.zip,
|
zip=lead.zip,
|
||||||
city=lead.city,
|
city=lead.city,
|
||||||
state=lead.state_id.name,
|
state=lead.state_id.name,
|
||||||
country=lead.country_id.name))
|
country=lead.country_id.name))
|
||||||
self.write(cr, uid, [lead.id], {
|
if result:
|
||||||
'partner_latitude': result and result[0] or False,
|
self.write(cr, uid, [lead.id], {
|
||||||
'partner_longitude': result and result[1] or False
|
'partner_latitude': result[0],
|
||||||
}, context=context)
|
'partner_longitude': result[1]
|
||||||
|
}, context=context)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def search_geo_partner(self, cr, uid, ids, context=None):
|
def search_geo_partner(self, cr, uid, ids, context=None):
|
||||||
|
|
Loading…
Reference in New Issue