[CONVERT] converted wizard.interface to osv.osv_memory for google_map module
bzr revid: bde@tinyerp.com-20110824064233-jvf01fvdbtrcufgs
This commit is contained in:
parent
ae7b1699cb
commit
ad09b92e2e
|
@ -36,7 +36,9 @@ Using this you can directly open Google Map from the URL widget.""",
|
|||
'images': ['images/google_map.jpeg'],
|
||||
'depends': ['base'],
|
||||
'init_xml': [],
|
||||
'update_xml': ['google_map_wizard.xml', 'google_map_view.xml'],
|
||||
'update_xml': ['google_map_view.xml',
|
||||
'wizard/google_map_launch_view.xml'
|
||||
],
|
||||
'demo_xml': [],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<label string="Street2 : " align="1.0"/>
|
||||
<group colspan="1" col="2">
|
||||
<field name="street2" nolabel="1"/>
|
||||
<button name="%(wizard_google_map)d"
|
||||
<button name="%(action_google_map_launch_form)d"
|
||||
string="Map" type="action" icon="gtk-zoom-in"/>
|
||||
</group>
|
||||
</field>
|
||||
|
@ -29,7 +29,7 @@
|
|||
<label string="Street2 : " align="1.0"/>
|
||||
<group colspan="1" col="2">
|
||||
<field name="street2" nolabel="1"/>
|
||||
<button name="%(wizard_google_map)d" string="Map" type="action" icon="gtk-zoom-in"/>
|
||||
<button name="%(action_google_map_launch_form)d" string="Map" type="action" icon="gtk-zoom-in"/>
|
||||
</group>
|
||||
</field>
|
||||
</field>
|
||||
|
@ -46,7 +46,7 @@
|
|||
<label string="Street2 : " align="1.0"/>
|
||||
<group colspan="1" col="2">
|
||||
<field name="street2" nolabel="1"/>
|
||||
<button name="%(wizard_google_map)d"
|
||||
<button name="%(action_google_map_launch_form)d"
|
||||
string="Map" type="action" icon="gtk-zoom-in"/>
|
||||
</group>
|
||||
</field>
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<wizard
|
||||
string="Launch Google Map"
|
||||
model="res.partner.address"
|
||||
name="google_map_launch"
|
||||
id="wizard_google_map"
|
||||
keyword="client_action_multi"/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -19,43 +19,38 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
from osv import osv
|
||||
import pooler
|
||||
from osv import fields
|
||||
import time
|
||||
|
||||
def _launch_wizard(self, cr, uid, data, context=None):
|
||||
address_obj= pooler.get_pool(cr.dbname).get('res.partner.address')
|
||||
m= address_obj.browse(cr, uid, data['id'], context=context)
|
||||
url=''
|
||||
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(' ','+')
|
||||
return {
|
||||
'type': 'ir.actions.act_url',
|
||||
'url':url,
|
||||
'target': 'new'
|
||||
}
|
||||
class launch_map(osv.osv_memory):
|
||||
|
||||
_name = "launch.map"
|
||||
|
||||
class launch_map(wizard.interface):
|
||||
def launch_wizard(self, cr, uid, data, context=None):
|
||||
address_obj= pooler.get_pool(cr.dbname).get('res.partner.address')
|
||||
m = address_obj.browse(cr, uid, data, context=context)[0]
|
||||
url=''
|
||||
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(' ','+')
|
||||
return {
|
||||
'type': 'ir.actions.act_url',
|
||||
'url':url,
|
||||
'target': 'new'
|
||||
}
|
||||
|
||||
states= {'init' : {'actions': [],
|
||||
'result':{'type':'action',
|
||||
'action': _launch_wizard,
|
||||
'state':'end'}
|
||||
}
|
||||
}
|
||||
launch_map('google_map_launch')
|
||||
launch_map()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_google_map_launch_form" model="ir.ui.view">
|
||||
<field name="name">launch.map.form</field>
|
||||
<field name="model">launch.map</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Launch Map">
|
||||
<group colspan="4">
|
||||
<separator string="Launch Map"/>
|
||||
<newline/>
|
||||
<button name="launch_wizard" string="Map" type="object" icon="gtk-zoom-in"/>
|
||||
<button string="Cancel" icon="gtk-cancel" special="cancel"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_google_map_launch_form" model="ir.actions.act_window">
|
||||
<field name="name">Google Map</field>
|
||||
<field name="res_model">launch.map</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,calendar,graph</field>
|
||||
<field name="target">new</field>
|
||||
<field name="view_id" ref="view_google_map_launch_form"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue