Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c01b7e2
[ADD] web_view_leaflet_map
legalsylvain Sep 14, 2022
ebb0145
[UPD] Update web_view_leaflet_map.pot
Feb 1, 2023
eecf824
[UPD] README.rst
OCA-git-bot Feb 1, 2023
2367dc1
[ADD] icon.png
OCA-git-bot Feb 1, 2023
cd38aff
[IMP] web_view_leaflet_map: black, isort, prettier
legalsylvain Jun 29, 2023
ce3c1eb
[IMP] web_view_leaflet_map*: black, isort, prettier
legalsylvain Jun 29, 2023
2be3907
[MIG] web_view_leaflet_map, web_view_leaflet_map_partner in V16
legalsylvain Jun 29, 2023
b934b81
[REF] Bump leaflet js library to 1.9.4, released on May 18, 2023. (fr…
legalsylvain Jun 29, 2023
203515f
[UPD] Update web_view_leaflet_map.pot
Dec 11, 2023
5c69639
Update translation files
weblate Dec 12, 2023
79b114c
Added translation using Weblate (Italian)
mymage Jan 26, 2024
9c642fa
Translated using Weblate (Italian)
mymage Jan 26, 2024
c921385
[REF] split web_view_leaflet_map into web_view_leaflet_map and web_le…
legalsylvain Oct 12, 2024
2423203
[BOT] post-merge updates
OCA-git-bot Oct 29, 2024
cb58702
[UPD] Update web_view_leaflet_map.pot
Oct 30, 2024
9fecc06
Update translation files
weblate Oct 30, 2024
b605ddc
[IMP] web_view_leaflet_map: pre-commit auto fixes
cesarportas Oct 1, 2025
eca9c0e
[17.0][MIG] web_view_leaflet_map: Refactor to OWL component
cesarportas Oct 3, 2025
2844b03
[17.0][MIG] web_view_leaflet_map: Refactor to OWL component
cesarportas Oct 3, 2025
82524a8
Revert "Importer gitlab work"
cesarportas Oct 3, 2025
fa847d7
[17.0][MIG] web_view_leaflet_map: Refactor to OWL component
cesarportas Oct 3, 2025
e720f9b
[17.0][MIG] web_view_leaflet_map: Refactor to OWL component
cesarportas Oct 6, 2025
f087173
[17.0][MIG] web_view_leaflet_map: pre-commit fix
cesarportas Oct 6, 2025
dc4f2d1
[IMP] web_view_leaflet_map: pre-commit auto fixes
mourad-ehm Oct 20, 2025
9f97191
[MIG] web_view_leaflet_map: Migration to 18.0
mourad-ehm Oct 21, 2025
a4c2500
[MIG] web_view_leaflet_map: fix view mode declaration for 18.0 migration
thibaultrey Nov 5, 2025
f80691b
[FIX] remove lealflet.js Library Update instructions from DEVELOP.md
mourad-ehm Nov 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 180 additions & 0 deletions web_view_leaflet_map/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
================================
Leaflet Map View (OpenStreetMap)
================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:52ae60ed2032c73f0ba6fc8ca70e2a2fc73bb12745aeeda793042efb1175c1b9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fgeospatial-lightgray.png?logo=github
:target: https://github.com/OCA/geospatial/tree/18.0/web_view_leaflet_map
:alt: OCA/geospatial
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/geospatial-18-0/geospatial-18-0-web_view_leaflet_map
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/geospatial&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

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``)

|image1|

|image2|

.. |image1| image:: https://raw.githubusercontent.com/OCA/geospatial/18.0/web_view_leaflet_map/static/description/view_res_partner_map_1.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/geospatial/18.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 <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Configuration
=============

- See configuration of the module ``web_leaflet_lib``.

Development
===========

Create a new view :

.. code:: xml

<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

.. code:: xml

<record id="my_module.action_my_model" model="ir.actions.act_window">
<field name="view_mode">tree,form,leaflet_map</field>
</record>

**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 <https://github.com/OCA/geospatial/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 <https://github.com/OCA/geospatial/issues/new?body=module:%20web_view_leaflet_map%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

.. |maintainer-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px
:target: https://github.com/legalsylvain
:alt: legalsylvain

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-legalsylvain|

This module is part of the `OCA/geospatial <https://github.com/OCA/geospatial/tree/18.0/web_view_leaflet_map>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions web_view_leaflet_map/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from .hooks import uninstall_hook
28 changes: 28 additions & 0 deletions web_view_leaflet_map/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (C) 2022 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Leaflet Map View (OpenStreetMap)",
"summary": "Add new 'leaflet_map' view, to display markers.",
"version": "18.0.1.0.0",
"development_status": "Alpha",
"author": "GRAP, Odoo Community Association (OCA)",
"maintainers": ["legalsylvain"],
"website": "https://github.com/OCA/geospatial",
"license": "AGPL-3",
"category": "Extra Tools",
"depends": [
"base_geolocalize",
"web_leaflet_lib",
],
"assets": {
"web.assets_backend": [
"web_view_leaflet_map/static/src/components/map-component/map_view.esm.js",
"web_view_leaflet_map/static/src/components/map-component/map_view.xml",
"web_view_leaflet_map/static/src/components/map-component/web_view_leaflet_map.css",
],
},
"installable": True,
"uninstall_hook": "uninstall_hook",
}
18 changes: 18 additions & 0 deletions web_view_leaflet_map/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (C) 2019, Open Source Integrators
# Copyright (C) 2022 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


def uninstall_hook(env):
env.cr.execute(
"UPDATE ir_act_window "
"SET view_mode=replace(view_mode, ',leaflet_map', '')"
"WHERE view_mode LIKE '%,leaflet_map%';"
)
env.cr.execute(
"UPDATE ir_act_window "
"SET view_mode=replace(view_mode, 'leaflet_map,', '')"
"WHERE view_mode LIKE '%leaflet_map,%';"
)
env.cr.execute("DELETE FROM ir_act_window " "WHERE view_mode = 'leaflet_map';")
79 changes: 79 additions & 0 deletions web_view_leaflet_map/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_view_leaflet_map
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-09-18 19:56+0000\n"
"PO-Revision-Date: 2022-09-18 19:56+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: web_view_leaflet_map
#: model:ir.model,name:web_view_leaflet_map.model_ir_actions_act_window_view
msgid "Action Window View"
msgstr "Vue de la Fenêtre d'Action"

#. module: web_view_leaflet_map
#: model:ir.model.fields.selection,name:web_view_leaflet_map.selection__ir_actions_act_window_view__view_mode__leaflet_map
#: model:ir.model.fields.selection,name:web_view_leaflet_map.selection__ir_ui_view__type__leaflet_map
msgid "Leaflet Map"
msgstr "Carte Leaflet"

#. module: web_view_leaflet_map
#. odoo-javascript
#: code:addons/web_view_leaflet_map/static/src/js/view/map/map_view.js:0
#, python-format
msgid "Map"
msgstr "Carte"

#. module: web_view_leaflet_map
#: model:ir.model,name:web_view_leaflet_map.model_res_users
msgid "User"
msgstr ""

#. module: web_view_leaflet_map
#: model:ir.model,name:web_view_leaflet_map.model_ir_ui_view
msgid "View"
msgstr "Vue"

#. module: web_view_leaflet_map
#: model:ir.model.fields,field_description:web_view_leaflet_map.field_ir_actions_act_window_view__view_mode
#: model:ir.model.fields,field_description:web_view_leaflet_map.field_ir_ui_view__type
#: model:ir.model.fields,field_description:web_view_leaflet_map.field_website_page__type
msgid "View Type"
msgstr "Type de Vue"

#~ msgid "Activity"
#~ msgstr "Activité"

#~ msgid "Calendar"
#~ msgstr "Calendrier"

#~ msgid "Diagram"
#~ msgstr "Diagramme"

#~ msgid "Form"
#~ msgstr "Formulaire"

#~ msgid "Graph"
#~ msgstr "Graphique"

#~ msgid "Pivot"
#~ msgstr "Tableau croisé dynamique"

#~ msgid "Search"
#~ msgstr "Rechercher"

#~ msgid "Tree"
#~ msgstr "Arborescence"

#~ msgid "Users"
#~ msgstr "Utilisateurs"
52 changes: 52 additions & 0 deletions web_view_leaflet_map/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_view_leaflet_map
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-01-26 08:36+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: web_view_leaflet_map
#: model:ir.model,name:web_view_leaflet_map.model_ir_actions_act_window_view
msgid "Action Window View"
msgstr "Vista maschera azione"

#. module: web_view_leaflet_map
#: model:ir.model.fields.selection,name:web_view_leaflet_map.selection__ir_actions_act_window_view__view_mode__leaflet_map
#: model:ir.model.fields.selection,name:web_view_leaflet_map.selection__ir_ui_view__type__leaflet_map
msgid "Leaflet Map"
msgstr "Mappa Leaflet"

#. module: web_view_leaflet_map
#. odoo-javascript
#: code:addons/web_view_leaflet_map/static/src/js/view/map/map_view.js:0
#, python-format
msgid "Map"
msgstr "Mappa"

#. module: web_view_leaflet_map
#: model:ir.model,name:web_view_leaflet_map.model_res_users
msgid "User"
msgstr "Utente"

#. module: web_view_leaflet_map
#: model:ir.model,name:web_view_leaflet_map.model_ir_ui_view
msgid "View"
msgstr "Vista"

#. module: web_view_leaflet_map
#: model:ir.model.fields,field_description:web_view_leaflet_map.field_ir_actions_act_window_view__view_mode
#: model:ir.model.fields,field_description:web_view_leaflet_map.field_ir_ui_view__type
#: model:ir.model.fields,field_description:web_view_leaflet_map.field_website_page__type
msgid "View Type"
msgstr "Tipo vista"
Loading