Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
9 Trả lời
20250 Lượt xem

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 .

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.


Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Tác giả

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

Tác giả

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 ?

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 9 18
106
1
thg 5 17
7954
0
thg 2 25
507
2
thg 12 24
654
0
thg 7 24
711