跳至内容
菜单
此问题已终结
9 回复
20248 查看

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 .

形象
丢弃
最佳答案

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.


形象
丢弃
编写者

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.

编写者

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

编写者

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 ?

相关帖文 回复 查看 活动
1
9月 18
106
1
5月 17
7952
0
2月 25
502
2
12月 24
653
0
7月 24
709