Skip to Content
Menu
This question has been flagged
9 Replies
20249 Zobrazenia

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
Zrušiť
Best Answer

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
Zrušiť
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 ?

Related Posts Replies Zobrazenia Aktivita
1
sep 18
106
1
máj 17
7953
0
feb 25
505
2
dec 24
654
0
júl 24
710