Skip to Content
Odoo मेन्यू
  • Sign in
  • मुफ़्त में आज़माएं
  • ऐप्लिकेशन
    फ़ाइनेंस
    • अकाउंटिंग
    • इनवॉइसिंग
    • एक्सपेंस
    • स्प्रेडशीट (बीआई)
    • डॉक्यूमेंट्स
    • साइन
    सेल्स
    • सीआरएम
    • सेल्स
    • पीओएस शॉप
    • पीओएस रेस्टोरेंट
    • सब्सक्रिप्शन
    • रेंटल
    वेबसाइट
    • वेबसाइट बिल्डर
    • ई-कॉमर्स
    • ब्लॉग
    • फ़ोरम
    • लाइव चैट
    • ई-लर्निंग
    सप्लाई चेन
    • इन्वेंट्री
    • मैन्युफ़ैक्चरिंग
    • पीएलएम
    • परचेज़
    • मेंटेनेंस
    • क्वालिटी
    मानव संसाधन
    • कर्मचारी
    • रिक्रूटमेंट
    • टाइम ऑफ़
    • अप्रेज़ल
    • रेफ़रल
    • फ़्लीट
    मार्केटिंग
    • सोशल मार्केटिंग
    • ईमेल मार्केटिंग
    • एसएमएस मार्केटिंग
    • इवेंट
    • मार्केटिंग ऑटोमेशन
    • सर्वे
    सेवाएं
    • प्रोजेक्ट
    • टाइमशीट
    • फ़ील्ड सर्विस
    • हेल्पडेस्क
    • प्लानिंग
    • अपॉइंटमेंट
    प्रॉडक्टिविटी
    • डिस्कस
    • अप्रूवल
    • आईओटी
    • वीओआईपी
    • नॉलेज
    • WhatsApp
    तीसरे पक्ष के ऐप्लिकेशन Odoo स्टूडियो Odoo क्लाउड प्लेटफ़ॉर्म
  • इंडस्ट्री
    रीटेल
    • बुक स्टोर
    • क्लोदिंग स्टोर
    • फ़र्नीचर स्टोर
    • ग्रॉसरी स्टोर
    • हार्डवेयर स्टोर
    • टॉय स्टोर
    Food & Hospitality
    • बार और पब
    • रेस्टोरेंट
    • फ़ास्ट फ़ूड
    • Guest House
    • बेवरिज डिस्ट्रीब्यूटर
    • होटल
    रियल एस्टेट
    • Real Estate Agency
    • आर्किटेक्चर फ़र्म
    • कंसट्रक्शन
    • एस्टेट मैनेजमेंट
    • गार्ड्निंग
    • प्रॉपर्टी ओनर असोसिएशन
    कंसल्टिंग
    • अकाउंटिंग फ़र्म
    • Odoo पार्टनर
    • मार्केटिंग एजेंसी
    • लॉ फ़र्म
    • टैलेंट ऐक्विज़िशन
    • ऑडिट & सर्टिफ़िकेशन
    मैन्युफ़ैक्चरिंग
    • टेक्सटाइल
    • Metal
    • फ़र्नीचर
    • फ़ूड
    • Brewery
    • कॉर्पोरेट गिफ़्ट
    हेल्थ & फिटनेस
    • स्पोर्ट्स क्लब
    • आईवियर स्टोर
    • फिटनेस सेंटर
    • वेलनेस प्रैक्टिशनर
    • फॉर्मेसी
    • हेयर सैलून
    Trades
    • Handyman
    • आईटी हॉर्डवेयर और सपोर्ट
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    अन्य
    • Nonprofit Organization
    • एन्वायरमेंटल एजेंसी
    • बिलबोर्ड रेंटल
    • फ़ोटोग्राफी
    • बाइक लीजिंग
    • सॉफ़्टवेयर रीसेलर
    Browse all Industries
  • कम्यूनिटी
    सीखें
    • ट्यूटोरियल्स
    • दस्तावेज़
    • सर्टिफ़िकेशन
    • ट्रेनिंग
    • ब्लॉग
    • पॉडकास्ट
    शिक्षा को बढ़ावा दें
    • एजुकेशन प्रोग्राम
    • स्केल अप! बिजनेस गेम
    • Odoo के ऑफ़िस में आएं
    सॉफ़्टवेयर पाएं
    • डाउनलोड
    • वर्शन की तुलना करें
    • रिलीज़
    साथ मिलकर काम करें
    • Github
    • फ़ोरम
    • इवेंट
    • अनुवाद
    • पार्टनर बनें
    • Services for Partners
    • अपना अकाउंटिंग फ़र्म रजिस्टर करें
    सेवाएं पाएं
    • पार्टनर ढूंढें
    • अकाउंटेंट खोजें
    • सलाहकार की मदद लें
    • इम्प्लिमेंटेशन सेवाएं
    • कस्टमर रेफ़रेंस
    • सहायता
    • अपग्रेड
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    डेमो देखें
  • कीमत
  • सहायता

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • सीआरएम
  • e-Commerce
  • लेखांकन
  • इन्वेंटरी
  • PoS
  • प्रोजेक्ट
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
Help

[10.0]Website Contact Us: How to show map with partner_longitude/partner_latitude instead of address?

Subscribe

Get notified when there's activity on this post

This question has been flagged
addressmapwebsite_contactlatitudelongitude
1 Reply
13277 Views
Avatar
Ermin Trevisan

How can I adapt the default map on the website "Contact Us" page, when I do not have an available address because it is in the middle of the woods, but I do have geographical latitude and longitude and I have also defined a Google Place.

This is the Google Place: Holzschopf

Using the Google Place or using longitude and latitude, I can create an Odoo-URL for the map thumbnail by replacing the address in the original Odoo Map URL with the Google Place name like this:

http://maps.googleapis.com/maps/api/staticmap?sensor=false&zoom=8&center=Holzschopf&key=....someGoogleAPIkey

or

http://maps.googleapis.com/maps/api/staticmap?sensor=false&zoom=8&center="47.1922423,8.5496122"&key=....someGoogleAPIkey&size=298x298

which renders the proper map thumbnail:



The thumbnail should then properly link to Google Maps:

https://www.google.com/maps/@47.1922423,8.5496122,15z/data=!4m5!3m4!1s0x479aabc19038c111:0x2bb45170352f9940!8m2!3d47.1922423!4d8.5583669

instead of

https://www.google.com/maps/search/H%C3%B6llwald,+Baar+6340,+Switzerland/@37.0625,-95.677068,4z

Can somebody give me a hint on how to create a small module which replaces the partner address by the corresponding fields partner_longitude and partner_latitude?

0
Avatar
Discard
Mohammed Amal N

Hi,

I think you are refer to the google map link opened in contact us page.

if so you need to change method 'google_map_link' in /addons/website/models/res_partner.py

Mohammed Amal N

I just tried it in original code

@api.multi

def google_map_link(self, zoom=10):

# params = {

# 'q': '%s, %s %s, %s' % (self.street or '', self.city or '', self.zip or '', self.country_id and self.country_id.name_get()[0][1] or ''),

# 'z': zoom,

# }

params = {

'q': '%s' % ('47.1922423,8.5496122'),

'z': zoom,

}

return urlplus('https://maps.google.com/maps', params)

You can create a new module inheriting res.partner

Ermin Trevisan
Author

Thanks Mohammed, this is exactly what I was looking for. How would this code look like when I would want to replace the explicit coordinates by the values of the fields partner_longitude and partner_latitude?

Ermin Trevisan
Author

Could it be like this:

params = {

'q': '%s' % (self.partner_longitude,self.partner_latitude),

'z': zoom,

}

Ermin Trevisan
Author

I would then make these fields editable in the module geo_localize, so these values can be manually entered when the localization based on the address does not work.

Mohammed Amal N

It will look like this

'q': '%s,%s' % (self.partner_longitude,self.partner_latitude),

You have to create fields partner_longitude and partner_latitude in res.partner because self refers to res.partner here

Ermin Trevisan
Author

OK, understood. The fields already exists because they are created when installing the module base_geolocalize. Thank you very much! I tried to convert your comment to an answer, but it is not possible, because of your original answer. So I will edit your original answer and upvote it.

Ermin Trevisan
Author

Are my edits correct like that?

Avatar
Mohammed Amal N
Best Answer

Hi

If you want to convert address to lat and long, try geopy python package. you can refer this link - geopy 

If you want to go to a link using google map you can use this format http://maps.google.com/maps?q=47.1922423,8.523348

Edit (do ignore the previous lines and the comments):

You can change the original code like this:

@api.multi

def google_map_link(self, zoom=10):

# params = {
# 'q': '%s, %s %s, %s' % (self.street or '', self.city or '', self.zip or '', self.country_id and self.country_id.name_get()[0][1] or ''),
# 'z': zoom,
# }

params = {
'q': '%s' % ('47.1922423,8.5496122'),
'z': zoom,
}
return urlplus('https://maps.google.com/maps', params)

Then you can create a new module inheriting res.partner.

If you want to use the existing fields (from the module base_geolocalize), do it like this:

@api.multi

def google_map_link(self, zoom=10):

        params = {
         'q': '%s,%s' % (self.partner_longitude,self.partner_latitude),
         'z': zoom,
     }

@api.multi

def google_map_img(self, zoom=8, width=298, height=298):

google_maps_api_key = self.env['ir.config_parameter'].sudo().get_param('google_maps_api_key')
if not google_maps_api_key:
return False
params = {
'center': '%s,%s' % (self.partner_longitude,self.partner_latitude),
 'size': "%sx%s" % (height, width),
'zoom': zoom,
'sensor': 'false',
'key': google_maps_api_key,
}
return urlplus('//maps.googleapis.com/maps/api/staticmap', params)


3
Avatar
Discard
Ermin Trevisan
Author

Thanks for your answer, but I already understand that, as you can read from my explanation. My point is: how can I change the Odoo code of the "Contact Us" page accordingly.

Mohammed Amal N

I'm not sure if you are looking for this.

The google map button is defined in the template with id company_description. You can inherit and replace the current button with your button

Ermin Trevisan
Author

Thank you very much for your continuing efforts. I'm not a developer, therefore it is very difficult for me to understand the basics behind it. While finding this link: https://stackoverflow.com/questions/34415906/how-do-i-add-a-google-maps-link-in-odoo I understand that I have to change the method of composing the rendered URL for the Google Map in addons/website/models/website.py and now it gets a little bit complicated for a simple minded heart as I am :-)

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
Finding location latitude and longitude from address Solved
latitude longitude Odoo13.0
Avatar
Avatar
1
अप्रैल 20
9742
Want to change Google Map from Street 2 to City
address google contact v6 map
Avatar
0
मार्च 15
5940
View name for webpage: xxxx.odoo.com/shop/address Solved
address
Avatar
Avatar
1
फ़र॰ 24
3279
Addresses not being found in map view
map
Avatar
Avatar
1
अक्तू॰ 24
3359
Problems with payment methods in ecommerce, Odoo13 Solved
address
Avatar
1
फ़र॰ 22
3150
कम्यूनिटी
  • ट्यूटोरियल्स
  • दस्तावेज़
  • फ़ोरम
ओपन सोर्स
  • डाउनलोड
  • Github
  • रनबॉट
  • अनुवाद
सेवाएं
  • Odoo.sh Hosting
  • सहायता
  • अपग्रेड
  • कस्टम डेवलपमेंट्स
  • शिक्षा
  • अकाउंटेंट खोजें
  • पार्टनर ढूंढें
  • पार्टनर बनें
हमारे बारे में
  • हमारी कंपनी
  • ब्रांड ऐसेट
  • संपर्क करें
  • नौकरियां
  • इवेंट
  • पॉडकास्ट
  • ब्लॉग
  • ग्राहक
  • लीगल • गोपनीयता
  • सुरक्षा
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo, बिज़नेस से जुड़े ऐप्लिकेशन का एक कलेक्शन है जो ओपन सोर्स पर आधारित है. इसमें आपकी कंपनी की हर ज़रूरत के लिए ऐप्लिकेशन हैं. जैसे, सीआरएम, ई-कॉमर्स, अकाउंटिंग, इन्वेंट्री, पॉइंट ऑफ़ सेल, प्रोजेक्ट मैनेजमेंट वगैरह.

Odoo की सबसे बड़ी खासियत है कि यह इस्तेमाल करने में बहुत आसान है और यह पूरी तरह से इंटिग्रेट किया हुआ है.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now