From ad09b92e2e3eea61afeb30a447436a6900450acd Mon Sep 17 00:00:00 2001 From: "Bharat (OpenERP)" Date: Wed, 24 Aug 2011 12:12:33 +0530 Subject: [CONVERT] converted wizard.interface to osv.osv_memory for google_map module bzr revid: bde@tinyerp.com-20110824064233-jvf01fvdbtrcufgs --- addons/google_map/wizard/google_map_launch.py | 57 ++++++++++++--------------- 1 file changed, 26 insertions(+), 31 deletions(-) (limited to 'addons/google_map/wizard/google_map_launch.py') diff --git a/addons/google_map/wizard/google_map_launch.py b/addons/google_map/wizard/google_map_launch.py index a2b3003da7c..c42aff61378 100644 --- a/addons/google_map/wizard/google_map_launch.py +++ b/addons/google_map/wizard/google_map_launch.py @@ -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: -- cgit v1.2.3 From 7101e8134fc15969425bcc929ad1d14ed40ab340 Mon Sep 17 00:00:00 2001 From: "Bharat (OpenERP)" Date: Tue, 6 Sep 2011 15:55:10 +0530 Subject: [IMP] improved the sequence of files in __openerp__.py and improved the coding of google_map_launch.py bzr revid: bde@tinyerp.com-20110906102510-hgl0yoqze417ezvg --- addons/google_map/wizard/google_map_launch.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'addons/google_map/wizard/google_map_launch.py') diff --git a/addons/google_map/wizard/google_map_launch.py b/addons/google_map/wizard/google_map_launch.py index c42aff61378..ea0e63869e9 100644 --- a/addons/google_map/wizard/google_map_launch.py +++ b/addons/google_map/wizard/google_map_launch.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,7 +15,7 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## @@ -25,13 +25,14 @@ from osv import fields import time class launch_map(osv.osv_memory): - + _name = "launch.map" + _description = "Google Map" - 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='' + 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) url="http://maps.google.com/maps?oi=map&q=" if m.street: url+=m.street.replace(' ','+') -- cgit v1.2.3 From 7a5c4d999b3db8a08a723e9324fe3038088cc4eb Mon Sep 17 00:00:00 2001 From: "Bharat (OpenERP)" Date: Wed, 7 Sep 2011 16:06:15 +0530 Subject: [REM] removed unnecessary headers and given meaningful variable name in google_map_launch.py bzr revid: bde@tinyerp.com-20110907103615-lstvq6gf37nrf4fy --- addons/google_map/wizard/google_map_launch.py | 33 ++++++++++++--------------- 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'addons/google_map/wizard/google_map_launch.py') diff --git a/addons/google_map/wizard/google_map_launch.py b/addons/google_map/wizard/google_map_launch.py index ea0e63869e9..12c7142fbb4 100644 --- a/addons/google_map/wizard/google_map_launch.py +++ b/addons/google_map/wizard/google_map_launch.py @@ -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, -- cgit v1.2.3 From 02e025483b2d27ff4b1c2a579bb07901fe873618 Mon Sep 17 00:00:00 2001 From: "Mustufa Rangwala (OpenERP)" Date: Wed, 7 Sep 2011 16:46:29 +0530 Subject: [REF] Google_map: remove unused import bzr revid: mra@tinyerp.com-20110907111629-q9lc0pdoxk73xphm --- addons/google_map/wizard/google_map_launch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/google_map/wizard/google_map_launch.py') diff --git a/addons/google_map/wizard/google_map_launch.py b/addons/google_map/wizard/google_map_launch.py index 12c7142fbb4..0d926462dc6 100644 --- a/addons/google_map/wizard/google_map_launch.py +++ b/addons/google_map/wizard/google_map_launch.py @@ -19,7 +19,7 @@ # ############################################################################## -from osv import osv, fields +from osv import osv class launch_map(osv.osv_memory): @@ -50,5 +50,6 @@ class launch_map(osv.osv_memory): } launch_map() + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: -- cgit v1.2.3