[Fix] crm_partner_assign:Fix the issue of address

bzr revid: sbh@tinyerp.com-20120322102104-ke4it4b2mos390gm
This commit is contained in:
Sbh (Openerp) 2012-03-22 15:51:04 +05:30
parent 0d41641edb
commit 1305494f22
1 changed files with 6 additions and 7 deletions

View File

@ -99,14 +99,13 @@ class res_partner(osv.osv):
def geo_localize(self, cr, uid, ids, context=None):
# Don't pass context to browse()! We need country names in english below
for partner in self.browse(cr, uid, ids):
if not partner.address:
if not partner:
continue
contact = partner.address[0] #TOFIX: should be get latitude and longitude for default contact?
result = geo_find(geo_query_address(street=contact.street,
zip=contact.zip,
city=contact.city,
state=contact.state_id.name,
country=contact.country_id.name))
result = geo_find(geo_query_address(street=partner.street,
zip=partner.zip,
city=partner.city,
state=partner.state_id.name,
country=partner.country_id.name))
if result:
self.write(cr, uid, [partner.id], {
'partner_latitude': result[0],