Ir al contenido
Menú
Se marcó esta pregunta
9 Respuestas
20337 Vistas

Hello everyone

I want to add google map to my form view without installing website .I will be fetching address from my custom address field and tagging that location on to google map.

Is there a way to do so without using website module. Because i don't want to install website .

Avatar
Descartar
Mejor respuesta

Hi onkar,

Try this widget: https://www.odoo.com/apps/modules/10.0/web_map

This is an App from Odoo Apps. It adds a widget map. You can Add Map on your Form view By the Following Code:

Eg:

<record id="partner_google_map_form_view" model="ir.ui.view">
<field name="name">partner_google_map_form_view.page</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page string="Map" name="partner_geo_map">
<field name="google_map_partner" widget="map" nolabel="1"/>
</page>
</xpath>
</field>
</record>

Python 

google_map_partner = fields.Char(string="Map")

Thank you.


Avatar
Descartar
Autor

thank you for your answer.

I want know what field are we supposed to use because i have custom address field for which i need to show the map view.

And do we have satellite view for the map

You can use Char Field.

Satellite view is not available. in my knowledge.

Autor

Thank you once again for your reply.

I used character field and widget map to show the map.

But how can i set coordinates to the char field to mark that location .

Hi,

Give this type of Value to Char field : {u'position': {u'lat': 20.593684, u'lng': 78.96288}, u'zoom': 3}

Eg:

import json

maps_loc = {u'position': {u'lat': 20.593684, u'lng': 78.96288}, u'zoom': 3}

json_map = json.dumps(maps_loc)

self.google_map_partner = json_map

Autor

Thank you

The map only shows in edit mode. It won't show on create nor view mode. Can you guys help me on this ?

Publicaciones relacionadas Respuestas Vistas Actividad
1
sept 18
106
1
may 17
8005
0
feb 25
583
2
dic 24
791
0
jul 24
775