24 lines
		
	
	
		
			890 B
		
	
	
	
		
			Python
		
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			890 B
		
	
	
	
		
			Python
		
	
	
| # -*- coding: utf-8 -*-
 | |
| # Part of Odoo. See LICENSE file for full copyright and licensing details.
 | |
| 
 | |
| from odoo import api, fields, models
 | |
| 
 | |
| class TZgoMaps(models.Model):
 | |
|     _inherit = 'res.partner'
 | |
| 
 | |
|     @api.multi
 | |
|     def goMaps(self):
 | |
|         for record in self:
 | |
|             street = record.street+',' if record.street else ''
 | |
|             zip = ' '+record.zip+',' if record.zip else ''
 | |
|             city = ' '+record.city+',' if record.city else ''
 | |
|             country_code = ' '+record.country_id.code+',' if record.country_id.code else ''
 | |
| #            gomaps_link = 'https://www.google.com/maps/place/'+street.replace('/','.')+zip+city+country_code
 | |
|             gomaps_link = 'https://www.google.com/maps/place/' + street + zip + city + country_code
 | |
|         return {
 | |
|             'type': 'ir.actions.act_url',
 | |
|             'url': '%s' % gomaps_link,
 | |
|             'view_mode':'form'
 | |
|         }
 | |
| 
 |