تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
9 الردود
20251 أدوات العرض

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
سبتمبر 18
106
1
مايو 17
7954
0
فبراير 25
507
2
ديسمبر 24
656
0
يوليو 24
714