[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
|
from osv import osv, fields
|
||||||
import pooler
|
|
||||||
from osv import fields
|
|
||||||
import time
|
|
||||||
|
|
||||||
class launch_map(osv.osv_memory):
|
class launch_map(osv.osv_memory):
|
||||||
|
|
||||||
_name = "launch.map"
|
_name = "launch.map"
|
||||||
_description = "Google Map"
|
_description = "Launch Google Map"
|
||||||
|
|
||||||
def launch_wizard(self, cr, uid, ids, context=None):
|
def launch_wizard(self, cr, uid, ids, context=None):
|
||||||
active_id = context.get('active_id', False)
|
active_id = context.get('active_id', False)
|
||||||
address_obj= self.pool.get('res.partner.address')
|
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="
|
url="http://maps.google.com/maps?oi=map&q="
|
||||||
if m.street:
|
if partner.street:
|
||||||
url+=m.street.replace(' ','+')
|
url+=partner.street.replace(' ','+')
|
||||||
if m.street2:
|
if partner.street2:
|
||||||
url+='+'+m.street2.replace(' ','+')
|
url+='+'+partner.street2.replace(' ','+')
|
||||||
if m.city:
|
if partner.city:
|
||||||
url+='+'+m.city.replace(' ','+')
|
url+='+'+partner.city.replace(' ','+')
|
||||||
if m.state_id:
|
if partner.state_id:
|
||||||
url+='+'+m.state_id.name.replace(' ','+')
|
url+='+'+partner.state_id.name.replace(' ','+')
|
||||||
if m.country_id:
|
if partner.country_id:
|
||||||
url+='+'+m.country_id.name.replace(' ','+')
|
url+='+'+partner.country_id.name.replace(' ','+')
|
||||||
if m.zip:
|
if partner.zip:
|
||||||
url+='+'+m.zip.replace(' ','+')
|
url+='+'+partner.zip.replace(' ','+')
|
||||||
return {
|
return {
|
||||||
'type': 'ir.actions.act_url',
|
'type': 'ir.actions.act_url',
|
||||||
'url':url,
|
'url':url,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Launch Map">
|
<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">
|
<group colspan="4" col="2">
|
||||||
<button string="Cancel" icon="gtk-cancel" special="cancel"/>
|
<button string="Cancel" icon="gtk-cancel" special="cancel"/>
|
||||||
<button name="launch_wizard" string="Map" type="object" icon="gtk-zoom-in"/>
|
<button name="launch_wizard" string="Map" type="object" icon="gtk-zoom-in"/>
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
<act_window
|
<act_window
|
||||||
name="Launch Google Map"
|
name="Launch Google Map"
|
||||||
id="view_google_map_launch_form"
|
id="act_google_map_launch_form"
|
||||||
res_model="launch.map"
|
res_model="launch.map"
|
||||||
src_model="res.partner.address"
|
src_model="res.partner.address"
|
||||||
view_mode="form"
|
view_mode="form"
|
||||||
|
|
Loading…
Reference in New Issue