[REM] removed unnecessary headers and given meaningful variable name in google_map_launch.py
bzr revid: bde@tinyerp.com-20110907103615-lstvq6gf37nrf4fy
This commit is contained in:
parent
6d97d0922e
commit
7a5c4d999b
|
@ -19,33 +19,30 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv
|
||||
import pooler
|
||||
from osv import fields
|
||||
import time
|
||||
from osv import osv, fields
|
||||
|
||||
class launch_map(osv.osv_memory):
|
||||
|
||||
_name = "launch.map"
|
||||
_description = "Google Map"
|
||||
_description = "Launch Google Map"
|
||||
|
||||
def launch_wizard(self, cr, uid, ids, context=None):
|
||||
active_id = context.get('active_id', False)
|
||||
address_obj= self.pool.get('res.partner.address')
|
||||
m = address_obj.browse(cr, uid, active_id, context=context)
|
||||
partner = address_obj.browse(cr, uid, active_id, context=context)
|
||||
url="http://maps.google.com/maps?oi=map&q="
|
||||
if m.street:
|
||||
url+=m.street.replace(' ','+')
|
||||
if m.street2:
|
||||
url+='+'+m.street2.replace(' ','+')
|
||||
if m.city:
|
||||
url+='+'+m.city.replace(' ','+')
|
||||
if m.state_id:
|
||||
url+='+'+m.state_id.name.replace(' ','+')
|
||||
if m.country_id:
|
||||
url+='+'+m.country_id.name.replace(' ','+')
|
||||
if m.zip:
|
||||
url+='+'+m.zip.replace(' ','+')
|
||||
if partner.street:
|
||||
url+=partner.street.replace(' ','+')
|
||||
if partner.street2:
|
||||
url+='+'+partner.street2.replace(' ','+')
|
||||
if partner.city:
|
||||
url+='+'+partner.city.replace(' ','+')
|
||||
if partner.state_id:
|
||||
url+='+'+partner.state_id.name.replace(' ','+')
|
||||
if partner.country_id:
|
||||
url+='+'+partner.country_id.name.replace(' ','+')
|
||||
if partner.zip:
|
||||
url+='+'+partner.zip.replace(' ','+')
|
||||
return {
|
||||
'type': 'ir.actions.act_url',
|
||||
'url':url,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Launch Map">
|
||||
<separator string="This wizard will launch Google Map" colspan="4"/>
|
||||
<separator string="This wizard will launch google map" colspan="4"/>
|
||||
<group colspan="4" col="2">
|
||||
<button string="Cancel" icon="gtk-cancel" special="cancel"/>
|
||||
<button name="launch_wizard" string="Map" type="object" icon="gtk-zoom-in"/>
|
||||
|
@ -28,7 +28,7 @@
|
|||
|
||||
<act_window
|
||||
name="Launch Google Map"
|
||||
id="view_google_map_launch_form"
|
||||
id="act_google_map_launch_form"
|
||||
res_model="launch.map"
|
||||
src_model="res.partner.address"
|
||||
view_mode="form"
|
||||
|
|
Loading…
Reference in New Issue