Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
      • Get a Tailored Demo
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +32 2 290 34 90
    • Get a Tailored Demo
  • Pricing
  • Help
  1. APPS
  2. Extra Tools
  3. Leaflet Map View (OpenStreetMap) v 16.0
  4. Sales Conditions FAQ

Leaflet Map View (OpenStreetMap)

by GRAP https://github.com/OCA/geospatial , Odoo Community Association (OCA) https://github.com/OCA/geospatial
Odoo
v 16.0 Third Party 406
Download for v 16.0 Deploy on Odoo.sh
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Availability
Odoo Online
Odoo.sh
On Premise
Community Apps Dependencies Show
Leaflet Javascript Library
Lines of code 277
Technical Name web_view_leaflet_map
LicenseAGPL-3
Websitehttps://github.com/OCA/geospatial
Versions 12.0 16.0
You bought this module and need support? Click here!

Leaflet Map View (OpenStreetMap)

Alpha License: AGPL-3 OCA/geospatial Translate me on Weblate Try me on Runboat

This module extends odoo views, to add a new kind of view, named leaflet_map that is using the Leaflet javascript library to use maps. (https://leafletjs.com/) This library is for exemple, used in the OpenStreetMap project. (https://www.openstreetmap.org/)

You can see a simple usage in the module web_view_leaflet_map_partner in the same OCA repository that displays your contact in a map, if latitude and longitude are defined. (To define latitude and longitude, refer to the Odoo module base_geolocalize)

https://raw.githubusercontent.com/OCA/geospatial/16.0/web_view_leaflet_map/static/description/view_res_partner_map_1.png
https://raw.githubusercontent.com/OCA/geospatial/16.0/web_view_leaflet_map/static/description/view_res_partner_map_2.png

Important

This is an alpha version, the data model and design can change at any time without warning. Only for development or testing purpose, do not use in production. More details on development status

Table of contents

  • Configuration
  • Development
  • Known issues / Roadmap
  • Bug Tracker
  • Credits
    • Authors
    • Contributors
    • Maintainers

Configuration

  • See configuration of the module web_leaflet_lib.

Development

Create a new view :

<record id="view_my_model_map" model="ir.ui.view">
    <field name="model">my.model</field>
    <field name="arch" type="xml">
        <leaflet_map
                field_latitude="FIELD_LATITUDE"
                field_longitude="FIELD_LONGITUDE"
                field_title="FIELD_TITLE"
                field_address="FIELD_ADDRESS"
                field_marker_icon_image="FIELD_MARKER_ICON_IMAGE"
            >
            <field name="__last_update"/>
            <field name="FIELD_LATITUDE"/>
            <field name="FIELD_LONGITUDE"/>
            <field name="FIELD_TITLE"/>
            <field name="FIELD_ADDRESS"/>
        </leaflet_map>
    </field>
</record>
  1. FIELD_LATITUDE and FIELD_LONGITUDE are the name of the fields that contains GPS coordinates of the model.
  2. FIELD_TITLE will be used when the popup is displayed, as a title.
  3. FIELD_ADDRESS will be used when the popup is displayed to display the adress.
  4. (optional) FIELD_MARKER_ICON_IMAGE, is the name of the image field to place as an icon of the marker. Note: You can set extra settings marker_icon_size_x, marker_icon_size_y, to define the size of the image, and marker_popup_anchor_x, marker_popup_anchor_y to define the position of the popup.

Map options :

  • default_zoom : define the default zoom value. (7 if not defined)
  • max_zoom : define the max zoom value. (19 if not defined)
  • zoom_snap : define the zoom level in each change. (1 if not defined)
  • Create or update an action for the model
<record id="my_module.action_my_model" model="ir.actions.act_window">
    <field name="view_mode">tree,form,leaflet_map</field>
</record>

Library Update

For the time being, the module embed the lealflet.js library version 1.8.0 ( released on April 18, 2022.)

If a new release is out:

  • please download it here https://leafletjs.com/download.html
  • update the javascript, css and images, present in the folder static/lib/leaflet
  • test the features
  • make a Pull Request

Default position in the map

By default, the position of the map is defined by the user, in the function get_default_leaflet_position. It returns the position of the current company, if defined. you can overload this function globally, or per model.

Known issues / Roadmap

  • For the time being, at the start of the map loading, the call of invalidateSize() is required. We should investigate why and try to remove that call. see https://github.com/Leaflet/Leaflet/issues/3002#issuecomment-93836022
  • For the time being, the map has “Markers” and allow to display odoo items if longitude and latitude are available. We could imagine other kind of usages, with Polylines, Polygons, etc… See all the leaflet options : https://leafletjs.com/reference.html

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • GRAP

Contributors

  • Sylvain LE GAL (https://www.twitter.com/legalsylvain)

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainer:

legalsylvain

This module is part of the OCA/geospatial project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.
  • Ratings
  • Discuss
There are no ratings yet!
by
Ola
on 4/2/25, 6:16 PM

when  i put : <record id="my_module.action_my_model" model="ir.actions.act_window">

    <field name="view_mode">tree,form,leaflet_map</field>

</record> to my action, I got this error: No default view of type 'leaflet_map' could be found !



not working for odoo 16, might be missing something, please guide
by
Ahmad alsariera
on 3/12/24, 8:26 AM

            res.partner

           

               

                        field_latitude="partner_latitude"

                        field_longitude="partner_longitude"

                        field_title="name"

                        field_address="street"

                        field_marker_icon_image="image_1920"

                    >

                   

                   

                   

                   

                   

               

           

       


Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with