[FIX]crm_partner_assign: now write latitude and longitude to False if the Google geocode API does not return latitude/longitude(for instance, if the api limit is reached). The previous geolocation might be false, and we certainly do not want to forward the lead to the wrong partner
bzr revid: dle@openerp.com-20131104174051-wvmdiwb8oytcb2fb
This commit is contained in:
parent
5f9167c03a
commit
b030c9b032
|
@ -187,18 +187,17 @@ 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):
|
||||
if not lead.country_id:
|
||||
continue
|
||||
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))
|
||||
if result:
|
||||
self.write(cr, uid, [lead.id], {
|
||||
'partner_latitude': result[0],
|
||||
'partner_longitude': result[1]
|
||||
}, context=context)
|
||||
result = None
|
||||
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)
|
||||
return True
|
||||
|
||||
def search_geo_partner(self, cr, uid, ids, context=None):
|
||||
|
|
Loading…
Reference in New Issue