odoo-addon-web-view-leaflet-map 16.0.2.0.0.3__py3-none-any.whl → 18.0.1.1.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. odoo/addons/web_view_leaflet_map/README.rst +96 -83
  2. odoo/addons/web_view_leaflet_map/__manifest__.py +7 -6
  3. odoo/addons/web_view_leaflet_map/hooks.py +4 -4
  4. odoo/addons/web_view_leaflet_map/i18n/fr.po +7 -5
  5. odoo/addons/web_view_leaflet_map/i18n/it.po +7 -5
  6. odoo/addons/web_view_leaflet_map/i18n/web_view_leaflet_map.pot +3 -5
  7. odoo/addons/web_view_leaflet_map/models/ir_ui_view.py +3 -0
  8. odoo/addons/web_view_leaflet_map/readme/CONFIGURE.md +1 -0
  9. odoo/addons/web_view_leaflet_map/readme/CONTRIBUTORS.md +1 -0
  10. odoo/addons/web_view_leaflet_map/readme/DESCRIPTION.md +23 -0
  11. odoo/addons/web_view_leaflet_map/readme/DEVELOP.md +53 -0
  12. odoo/addons/web_view_leaflet_map/readme/ROADMAP.md +13 -0
  13. odoo/addons/web_view_leaflet_map/static/description/index.html +69 -62
  14. odoo/addons/web_view_leaflet_map/static/description/res_partner_large.png +0 -0
  15. odoo/addons/web_view_leaflet_map/static/description/res_partner_precise.png +0 -0
  16. odoo/addons/web_view_leaflet_map/static/src/views/leaflet_map/leaflet_map_controller.esm.js +24 -0
  17. odoo/addons/web_view_leaflet_map/static/src/views/leaflet_map/leaflet_map_controller.xml +24 -0
  18. odoo/addons/web_view_leaflet_map/static/src/views/leaflet_map/leaflet_map_renderer.esm.js +275 -0
  19. odoo/addons/web_view_leaflet_map/static/src/views/leaflet_map/leaflet_map_renderer.xml +10 -0
  20. odoo/addons/web_view_leaflet_map/static/src/views/leaflet_map/leaflet_map_view.esm.js +53 -0
  21. odoo_addon_web_view_leaflet_map-18.0.1.1.2.1.dist-info/METADATA +212 -0
  22. odoo_addon_web_view_leaflet_map-18.0.1.1.2.1.dist-info/RECORD +30 -0
  23. {odoo_addon_web_view_leaflet_map-16.0.2.0.0.3.dist-info → odoo_addon_web_view_leaflet_map-18.0.1.1.2.1.dist-info}/WHEEL +1 -1
  24. odoo_addon_web_view_leaflet_map-18.0.1.1.2.1.dist-info/top_level.txt +1 -0
  25. odoo/addons/web_view_leaflet_map/readme/CONFIGURE.rst +0 -1
  26. odoo/addons/web_view_leaflet_map/readme/CONTRIBUTORS.rst +0 -1
  27. odoo/addons/web_view_leaflet_map/readme/DESCRIPTION.rst +0 -11
  28. odoo/addons/web_view_leaflet_map/readme/DEVELOP.rst +0 -62
  29. odoo/addons/web_view_leaflet_map/readme/ROADMAP.rst +0 -8
  30. odoo/addons/web_view_leaflet_map/static/description/res_partner_map.png +0 -0
  31. odoo/addons/web_view_leaflet_map/static/src/js/view/map/map_renderer.js +0 -178
  32. odoo/addons/web_view_leaflet_map/static/src/js/view/map/map_view.js +0 -34
  33. odoo/addons/web_view_leaflet_map/static/src/js/view/view_registry.js +0 -8
  34. odoo_addon_web_view_leaflet_map-16.0.2.0.0.3.dist-info/METADATA +0 -199
  35. odoo_addon_web_view_leaflet_map-16.0.2.0.0.3.dist-info/RECORD +0 -27
  36. odoo_addon_web_view_leaflet_map-16.0.2.0.0.3.dist-info/top_level.txt +0 -1
  37. /odoo/addons/web_view_leaflet_map/static/src/{css/web_view_leaflet_map.css → views/leaflet_map/leaflet_map_renderer.css} +0 -0
@@ -1,3 +1,7 @@
1
+ .. image:: https://odoo-community.org/readme-banner-image
2
+ :target: https://odoo-community.org/get-involved?utm_source=readme
3
+ :alt: Odoo Community Association
4
+
1
5
  ================================
2
6
  Leaflet Map View (OpenStreetMap)
3
7
  ================================
@@ -7,43 +11,52 @@ Leaflet Map View (OpenStreetMap)
7
11
  !! This file is generated by oca-gen-addon-readme !!
8
12
  !! changes will be overwritten. !!
9
13
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10
- !! source digest: sha256:f494ec35cbd29ae4bcc5e46a7a30bf5b2261bd449a3b0ba08a95a70d45dbea12
14
+ !! source digest: sha256:74bf9361fbf3e37a4355f272c0cfb21bff1711d71639a7164dfe915bfc7773ab
11
15
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
16
 
13
- .. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
17
+ .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14
18
  :target: https://odoo-community.org/page/development-status
15
- :alt: Alpha
16
- .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
19
+ :alt: Beta
20
+ .. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
17
21
  :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18
22
  :alt: License: AGPL-3
19
23
  .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fgeospatial-lightgray.png?logo=github
20
- :target: https://github.com/OCA/geospatial/tree/16.0/web_view_leaflet_map
24
+ :target: https://github.com/OCA/geospatial/tree/18.0/web_view_leaflet_map
21
25
  :alt: OCA/geospatial
22
26
  .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23
- :target: https://translation.odoo-community.org/projects/geospatial-16-0/geospatial-16-0-web_view_leaflet_map
27
+ :target: https://translation.odoo-community.org/projects/geospatial-18-0/geospatial-18-0-web_view_leaflet_map
24
28
  :alt: Translate me on Weblate
25
29
  .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26
- :target: https://runboat.odoo-community.org/builds?repo=OCA/geospatial&target_branch=16.0
30
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/geospatial&target_branch=18.0
27
31
  :alt: Try me on Runboat
28
32
 
29
33
  |badge1| |badge2| |badge3| |badge4| |badge5|
30
34
 
31
- This module extends odoo views, to add a new kind of view, named ``leaflet_map``
32
- that is using the Leaflet javascript library to use maps. (https://leafletjs.com/)
33
- This library is for exemple, used in the OpenStreetMap project. (https://www.openstreetmap.org/)
35
+ This module extends odoo views, to add a new kind of view, named
36
+ ``leaflet_map`` that is using the Leaflet javascript library to use
37
+ maps. (https://leafletjs.com/) This library is for exemple, used in the
38
+ OpenStreetMap project. (https://www.openstreetmap.org/)
39
+
40
+ You can see a simple usage in the module
41
+ ``web_view_leaflet_map_partner`` in the same OCA repository that
42
+ displays your contact in a map, if latitude and longitude are defined.
43
+ (To define latitude and longitude, refer to the Odoo module
44
+ ``base_geolocalize``)
34
45
 
35
- You can see a simple usage in the module ``web_view_leaflet_map_partner`` in the
36
- same OCA repository that displays your contact in a map, if latitude and longitude are
37
- defined. (To define latitude and longitude, refer to the Odoo module ``base_geolocalize``)
46
+ A marker will be displayed for each item that has a localization.
38
47
 
39
- .. figure:: https://raw.githubusercontent.com/OCA/geospatial/16.0/web_view_leaflet_map/static/description/view_res_partner_map_1.png
48
+ |image1|
40
49
 
41
- .. figure:: https://raw.githubusercontent.com/OCA/geospatial/16.0/web_view_leaflet_map/static/description/view_res_partner_map_2.png
50
+ If user zooms out, the markers will overlap, which won't be very
51
+ visible.
42
52
 
43
- .. IMPORTANT::
44
- This is an alpha version, the data model and design can change at any time without warning.
45
- Only for development or testing purpose, do not use in production.
46
- `More details on development status <https://odoo-community.org/page/development-status>`_
53
+ In that case, nearby markers are grouped together, thanks to
54
+ ``Leaflet.markercluster`` plugin.
55
+
56
+ |image2|
57
+
58
+ .. |image1| image:: https://raw.githubusercontent.com/OCA/geospatial/18.0/web_view_leaflet_map/static/description/view_res_partner_map_precise.png
59
+ .. |image2| image:: https://raw.githubusercontent.com/OCA/geospatial/18.0/web_view_leaflet_map/static/description/view_res_partner_map_large.png
47
60
 
48
61
  **Table of contents**
49
62
 
@@ -53,85 +66,85 @@ defined. (To define latitude and longitude, refer to the Odoo module ``base_geol
53
66
  Configuration
54
67
  =============
55
68
 
56
- * See configuration of the module ``web_leaflet_lib``.
69
+ - See configuration of the module ``web_leaflet_lib``.
57
70
 
58
71
  Development
59
72
  ===========
60
73
 
61
74
  Create a new view :
62
75
 
63
- .. code-block:: xml
64
-
65
- <record id="view_my_model_map" model="ir.ui.view">
66
- <field name="model">my.model</field>
67
- <field name="arch" type="xml">
68
- <leaflet_map
69
- field_latitude="FIELD_LATITUDE"
70
- field_longitude="FIELD_LONGITUDE"
71
- field_title="FIELD_TITLE"
72
- field_address="FIELD_ADDRESS"
73
- field_marker_icon_image="FIELD_MARKER_ICON_IMAGE"
74
- >
75
- <field name="__last_update"/>
76
- <field name="FIELD_LATITUDE"/>
77
- <field name="FIELD_LONGITUDE"/>
78
- <field name="FIELD_TITLE"/>
79
- <field name="FIELD_ADDRESS"/>
80
- </leaflet_map>
81
- </field>
82
- </record>
83
-
84
- 1. FIELD_LATITUDE and FIELD_LONGITUDE are the name of the fields that contains GPS coordinates of the model.
76
+ .. code:: xml
77
+
78
+ <record id="view_my_model_map" model="ir.ui.view">
79
+ <field name="model">my.model</field>
80
+ <field name="arch" type="xml">
81
+ <leaflet_map
82
+ field_latitude="FIELD_LATITUDE"
83
+ field_longitude="FIELD_LONGITUDE"
84
+ field_title="FIELD_TITLE"
85
+ field_address="FIELD_ADDRESS"
86
+ field_marker_icon_image="FIELD_MARKER_ICON_IMAGE"
87
+ >
88
+ <field name="__last_update"/>
89
+ <field name="FIELD_LATITUDE"/>
90
+ <field name="FIELD_LONGITUDE"/>
91
+ <field name="FIELD_TITLE"/>
92
+ <field name="FIELD_ADDRESS"/>
93
+ </leaflet_map>
94
+ </field>
95
+ </record>
96
+
97
+ 1. FIELD_LATITUDE and FIELD_LONGITUDE are the name of the fields that
98
+ contains GPS coordinates of the model.
85
99
  2. FIELD_TITLE will be used when the popup is displayed, as a title.
86
- 3. FIELD_ADDRESS will be used when the popup is displayed to display the adress.
87
- 4. (optional) FIELD_MARKER_ICON_IMAGE, is the name of the image field to place as an icon
88
- of the marker.
89
- Note: You can set extra settings ``marker_icon_size_x``, ``marker_icon_size_y``, to define
90
- the size of the image, and ``marker_popup_anchor_x``, ``marker_popup_anchor_y`` to define
91
- the position of the popup.
100
+ 3. FIELD_ADDRESS will be used when the popup is displayed to display the
101
+ adress.
102
+ 4. (optional) FIELD_MARKER_ICON_IMAGE, is the name of the image field to
103
+ place as an icon of the marker. Note: You can set extra settings
104
+ ``marker_icon_size_x``, ``marker_icon_size_y``, to define the size of
105
+ the image, and ``marker_popup_anchor_x``, ``marker_popup_anchor_y``
106
+ to define the position of the popup.
92
107
 
93
108
  Map options :
94
109
 
95
110
  - ``default_zoom`` : define the default zoom value. (7 if not defined)
96
111
  - ``max_zoom`` : define the max zoom value. (19 if not defined)
97
- - ``zoom_snap`` : define the zoom level in each change. (1 if not defined)
98
-
99
- * Create or update an action for the model
112
+ - ``zoom_snap`` : define the zoom level in each change. (1 if not
113
+ defined)
114
+ - Create or update an action for the model
100
115
 
101
- .. code-block:: xml
116
+ .. code:: xml
102
117
 
103
- <record id="my_module.action_my_model" model="ir.actions.act_window">
104
- <field name="view_mode">tree,form,leaflet_map</field>
105
- </record>
106
-
107
- **Library Update**
108
-
109
- For the time being, the module embed the lealflet.js library version 1.8.0 ( released on April 18, 2022.)
110
-
111
- If a new release is out:
112
-
113
- - please download it here https://leafletjs.com/download.html
114
- - update the javascript, css and images, present in the folder ``static/lib/leaflet``
115
- - test the features
116
- - make a Pull Request
118
+ <record id="my_module.action_my_model" model="ir.actions.act_window">
119
+ <field name="view_mode">tree,form,leaflet_map</field>
120
+ </record>
117
121
 
118
122
  **Default position in the map**
119
123
 
120
- By default, the position of the map is defined by the user, in the function
121
- ``get_default_leaflet_position``. It returns the position of the current company, if defined.
122
- you can overload this function globally, or per model.
124
+ By default, the position of the map is defined by the user, in the
125
+ function ``get_default_leaflet_position``. It returns the position of
126
+ the current company, if defined. you can overload this function
127
+ globally, or per model.
123
128
 
124
129
  Known issues / Roadmap
125
130
  ======================
126
131
 
127
- * For the time being, at the start of the map loading, the call of ``invalidateSize()``
128
- is required. We should investigate why and try to remove that call.
129
- see https://github.com/Leaflet/Leaflet/issues/3002#issuecomment-93836022
130
-
131
- * For the time being, the map has "Markers" and allow to display odoo items
132
- if longitude and latitude are available. We could imagine other kind of usages,
133
- with Polylines, Polygons, etc...
134
- See all the leaflet options : https://leafletjs.com/reference.html
132
+ - For the time being, at the start of the map loading, the call of
133
+ ``invalidateSize()`` is required. We should investigate why and try to
134
+ remove that call. see
135
+ https://github.com/Leaflet/Leaflet/issues/3002#issuecomment-93836022
136
+ - For the time being, the map has "Markers" and allow to display odoo
137
+ items if longitude and latitude are available. We could imagine other
138
+ kind of usages, with Polylines, Polygons, etc... See all the leaflet
139
+ options : https://leafletjs.com/reference.html
140
+ - Search bar is not implemented in this view. All records are displayed
141
+ for now. We should:
142
+
143
+ - implement records refresh, when adding / removing domain in the
144
+ search bar.
145
+ - implement a custom search based on the displayed map. (no need to
146
+ load records that are out of the scope of the current displayed
147
+ map).
135
148
 
136
149
  Bug Tracker
137
150
  ===========
@@ -139,7 +152,7 @@ Bug Tracker
139
152
  Bugs are tracked on `GitHub Issues <https://github.com/OCA/geospatial/issues>`_.
140
153
  In case of trouble, please check there if your issue has already been reported.
141
154
  If you spotted it first, help us to smash it by providing a detailed and welcomed
142
- `feedback <https://github.com/OCA/geospatial/issues/new?body=module:%20web_view_leaflet_map%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
155
+ `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**>`_.
143
156
 
144
157
  Do not contact contributors directly about support or help with technical issues.
145
158
 
@@ -147,17 +160,17 @@ Credits
147
160
  =======
148
161
 
149
162
  Authors
150
- ~~~~~~~
163
+ -------
151
164
 
152
165
  * GRAP
153
166
 
154
167
  Contributors
155
- ~~~~~~~~~~~~
168
+ ------------
156
169
 
157
- * Sylvain LE GAL (https://www.twitter.com/legalsylvain)
170
+ - Sylvain LE GAL (https://www.twitter.com/legalsylvain)
158
171
 
159
172
  Maintainers
160
- ~~~~~~~~~~~
173
+ -----------
161
174
 
162
175
  This module is maintained by the OCA.
163
176
 
@@ -177,6 +190,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
177
190
 
178
191
  |maintainer-legalsylvain|
179
192
 
180
- This module is part of the `OCA/geospatial <https://github.com/OCA/geospatial/tree/16.0/web_view_leaflet_map>`_ project on GitHub.
193
+ This module is part of the `OCA/geospatial <https://github.com/OCA/geospatial/tree/18.0/web_view_leaflet_map>`_ project on GitHub.
181
194
 
182
195
  You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
@@ -5,8 +5,7 @@
5
5
  {
6
6
  "name": "Leaflet Map View (OpenStreetMap)",
7
7
  "summary": "Add new 'leaflet_map' view, to display markers.",
8
- "version": "16.0.2.0.0",
9
- "development_status": "Alpha",
8
+ "version": "18.0.1.1.2",
10
9
  "author": "GRAP, Odoo Community Association (OCA)",
11
10
  "maintainers": ["legalsylvain"],
12
11
  "website": "https://github.com/OCA/geospatial",
@@ -18,10 +17,12 @@
18
17
  ],
19
18
  "assets": {
20
19
  "web.assets_backend": [
21
- "web_view_leaflet_map/static/src/js/view/view_registry.js",
22
- "web_view_leaflet_map/static/src/js/view/map/map_renderer.js",
23
- "web_view_leaflet_map/static/src/js/view/map/map_view.js",
24
- "web_view_leaflet_map/static/src/css/web_view_leaflet_map.css",
20
+ "web_view_leaflet_map/static/src/views/leaflet_map/leaflet_map_renderer.esm.js",
21
+ "web_view_leaflet_map/static/src/views/leaflet_map/leaflet_map_renderer.xml",
22
+ "web_view_leaflet_map/static/src/views/leaflet_map/leaflet_map_renderer.css",
23
+ "web_view_leaflet_map/static/src/views/leaflet_map/leaflet_map_controller.esm.js",
24
+ "web_view_leaflet_map/static/src/views/leaflet_map/leaflet_map_controller.xml",
25
+ "web_view_leaflet_map/static/src/views/leaflet_map/leaflet_map_view.esm.js",
25
26
  ],
26
27
  },
27
28
  "installable": True,
@@ -4,15 +4,15 @@
4
4
  # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
5
5
 
6
6
 
7
- def uninstall_hook(cr, registry):
8
- cr.execute(
7
+ def uninstall_hook(env):
8
+ env.cr.execute(
9
9
  "UPDATE ir_act_window "
10
10
  "SET view_mode=replace(view_mode, ',leaflet_map', '')"
11
11
  "WHERE view_mode LIKE '%,leaflet_map%';"
12
12
  )
13
- cr.execute(
13
+ env.cr.execute(
14
14
  "UPDATE ir_act_window "
15
15
  "SET view_mode=replace(view_mode, 'leaflet_map,', '')"
16
16
  "WHERE view_mode LIKE '%leaflet_map,%';"
17
17
  )
18
- cr.execute("DELETE FROM ir_act_window " "WHERE view_mode = 'leaflet_map';")
18
+ env.cr.execute("DELETE FROM ir_act_window " "WHERE view_mode = 'leaflet_map';")
@@ -29,10 +29,9 @@ msgstr "Carte Leaflet"
29
29
 
30
30
  #. module: web_view_leaflet_map
31
31
  #. odoo-javascript
32
- #: code:addons/web_view_leaflet_map/static/src/js/view/map/map_view.js:0
33
- #, python-format
34
- msgid "Map"
35
- msgstr "Carte"
32
+ #: code:addons/web_view_leaflet_map/static/src/views/leaflet_map/leaflet_map_controller.xml:0
33
+ msgid "New"
34
+ msgstr ""
36
35
 
37
36
  #. module: web_view_leaflet_map
38
37
  #: model:ir.model,name:web_view_leaflet_map.model_res_users
@@ -47,10 +46,13 @@ msgstr "Vue"
47
46
  #. module: web_view_leaflet_map
48
47
  #: model:ir.model.fields,field_description:web_view_leaflet_map.field_ir_actions_act_window_view__view_mode
49
48
  #: model:ir.model.fields,field_description:web_view_leaflet_map.field_ir_ui_view__type
50
- #: model:ir.model.fields,field_description:web_view_leaflet_map.field_website_page__type
51
49
  msgid "View Type"
52
50
  msgstr "Type de Vue"
53
51
 
52
+ #, python-format
53
+ #~ msgid "Map"
54
+ #~ msgstr "Carte"
55
+
54
56
  #~ msgid "Activity"
55
57
  #~ msgstr "Activité"
56
58
 
@@ -29,10 +29,9 @@ msgstr "Mappa Leaflet"
29
29
 
30
30
  #. module: web_view_leaflet_map
31
31
  #. odoo-javascript
32
- #: code:addons/web_view_leaflet_map/static/src/js/view/map/map_view.js:0
33
- #, python-format
34
- msgid "Map"
35
- msgstr "Mappa"
32
+ #: code:addons/web_view_leaflet_map/static/src/views/leaflet_map/leaflet_map_controller.xml:0
33
+ msgid "New"
34
+ msgstr ""
36
35
 
37
36
  #. module: web_view_leaflet_map
38
37
  #: model:ir.model,name:web_view_leaflet_map.model_res_users
@@ -47,6 +46,9 @@ msgstr "Vista"
47
46
  #. module: web_view_leaflet_map
48
47
  #: model:ir.model.fields,field_description:web_view_leaflet_map.field_ir_actions_act_window_view__view_mode
49
48
  #: model:ir.model.fields,field_description:web_view_leaflet_map.field_ir_ui_view__type
50
- #: model:ir.model.fields,field_description:web_view_leaflet_map.field_website_page__type
51
49
  msgid "View Type"
52
50
  msgstr "Tipo vista"
51
+
52
+ #, python-format
53
+ #~ msgid "Map"
54
+ #~ msgstr "Mappa"
@@ -4,7 +4,7 @@
4
4
  #
5
5
  msgid ""
6
6
  msgstr ""
7
- "Project-Id-Version: Odoo Server 16.0\n"
7
+ "Project-Id-Version: Odoo Server 18.0\n"
8
8
  "Report-Msgid-Bugs-To: \n"
9
9
  "Last-Translator: \n"
10
10
  "Language-Team: \n"
@@ -26,9 +26,8 @@ msgstr ""
26
26
 
27
27
  #. module: web_view_leaflet_map
28
28
  #. odoo-javascript
29
- #: code:addons/web_view_leaflet_map/static/src/js/view/map/map_view.js:0
30
- #, python-format
31
- msgid "Map"
29
+ #: code:addons/web_view_leaflet_map/static/src/views/leaflet_map/leaflet_map_controller.xml:0
30
+ msgid "New"
32
31
  msgstr ""
33
32
 
34
33
  #. module: web_view_leaflet_map
@@ -44,6 +43,5 @@ msgstr ""
44
43
  #. module: web_view_leaflet_map
45
44
  #: model:ir.model.fields,field_description:web_view_leaflet_map.field_ir_actions_act_window_view__view_mode
46
45
  #: model:ir.model.fields,field_description:web_view_leaflet_map.field_ir_ui_view__type
47
- #: model:ir.model.fields,field_description:web_view_leaflet_map.field_website_page__type
48
46
  msgid "View Type"
49
47
  msgstr ""
@@ -10,3 +10,6 @@ class IrUiView(models.Model):
10
10
  _inherit = "ir.ui.view"
11
11
 
12
12
  type = fields.Selection(selection_add=[("leaflet_map", "Leaflet Map")])
13
+
14
+ def _get_view_info(self):
15
+ return {"leaflet_map": {"icon": "fa fa-map-o"}} | super()._get_view_info()
@@ -0,0 +1 @@
1
+ - See configuration of the module `web_leaflet_lib`.
@@ -0,0 +1 @@
1
+ - Sylvain LE GAL (<https://www.twitter.com/legalsylvain>)
@@ -0,0 +1,23 @@
1
+ This module extends odoo views, to add a new kind of view, named
2
+ `leaflet_map` that is using the Leaflet javascript library to use maps.
3
+ (<https://leafletjs.com/>) This library is for exemple, used in the
4
+ OpenStreetMap project. (<https://www.openstreetmap.org/>)
5
+
6
+ You can see a simple usage in the module `web_view_leaflet_map_partner`
7
+ in the same OCA repository that displays your contact in a map, if
8
+ latitude and longitude are defined. (To define latitude and longitude,
9
+ refer to the Odoo module `base_geolocalize`)
10
+
11
+ A marker will be displayed for each item that has a localization.
12
+
13
+ ![](../static/description/view_res_partner_map_precise.png)
14
+
15
+ If user zooms out, the markers will overlap, which won't be very visible.
16
+
17
+ In that case, nearby markers are grouped together, thanks to
18
+ `Leaflet.markercluster` plugin.
19
+
20
+ ![](../static/description/view_res_partner_map_large.png)
21
+
22
+
23
+
@@ -0,0 +1,53 @@
1
+ Create a new view :
2
+
3
+ ``` xml
4
+ <record id="view_my_model_map" model="ir.ui.view">
5
+ <field name="model">my.model</field>
6
+ <field name="arch" type="xml">
7
+ <leaflet_map
8
+ field_latitude="FIELD_LATITUDE"
9
+ field_longitude="FIELD_LONGITUDE"
10
+ field_title="FIELD_TITLE"
11
+ field_address="FIELD_ADDRESS"
12
+ field_marker_icon_image="FIELD_MARKER_ICON_IMAGE"
13
+ >
14
+ <field name="__last_update"/>
15
+ <field name="FIELD_LATITUDE"/>
16
+ <field name="FIELD_LONGITUDE"/>
17
+ <field name="FIELD_TITLE"/>
18
+ <field name="FIELD_ADDRESS"/>
19
+ </leaflet_map>
20
+ </field>
21
+ </record>
22
+ ```
23
+
24
+ 1. FIELD_LATITUDE and FIELD_LONGITUDE are the name of the fields that
25
+ contains GPS coordinates of the model.
26
+ 2. FIELD_TITLE will be used when the popup is displayed, as a title.
27
+ 3. FIELD_ADDRESS will be used when the popup is displayed to display
28
+ the adress.
29
+ 4. (optional) FIELD_MARKER_ICON_IMAGE, is the name of the image field
30
+ to place as an icon of the marker. Note: You can set extra settings
31
+ `marker_icon_size_x`, `marker_icon_size_y`, to define the size of
32
+ the image, and `marker_popup_anchor_x`, `marker_popup_anchor_y` to
33
+ define the position of the popup.
34
+
35
+ Map options :
36
+
37
+ - `default_zoom` : define the default zoom value. (7 if not defined)
38
+ - `max_zoom` : define the max zoom value. (19 if not defined)
39
+ - `zoom_snap` : define the zoom level in each change. (1 if not defined)
40
+ - Create or update an action for the model
41
+
42
+ ``` xml
43
+ <record id="my_module.action_my_model" model="ir.actions.act_window">
44
+ <field name="view_mode">tree,form,leaflet_map</field>
45
+ </record>
46
+ ```
47
+
48
+ **Default position in the map**
49
+
50
+ By default, the position of the map is defined by the user, in the
51
+ function `get_default_leaflet_position`. It returns the position of the
52
+ current company, if defined. you can overload this function globally, or
53
+ per model.
@@ -0,0 +1,13 @@
1
+ - For the time being, at the start of the map loading, the call of
2
+ `invalidateSize()` is required. We should investigate why and try to
3
+ remove that call. see
4
+ <https://github.com/Leaflet/Leaflet/issues/3002#issuecomment-93836022>
5
+ - For the time being, the map has "Markers" and allow to display odoo
6
+ items if longitude and latitude are available. We could imagine other
7
+ kind of usages, with Polylines, Polygons, etc... See all the leaflet
8
+ options : <https://leafletjs.com/reference.html>
9
+ - Search bar is not implemented in this view. All records are displayed for now.
10
+ We should:
11
+ - implement records refresh, when adding / removing domain in the search bar.
12
+ - implement a custom search based on the displayed map. (no need to load records
13
+ that are out of the scope of the current displayed map).