odoo-addon-web-view-leaflet-map 16.0.2.0.0.1__py3-none-any.whl → 18.0.1.0.0.3__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.
- odoo/addons/web_view_leaflet_map/README.rst +74 -76
- odoo/addons/web_view_leaflet_map/__manifest__.py +4 -5
- odoo/addons/web_view_leaflet_map/hooks.py +4 -4
- odoo/addons/web_view_leaflet_map/i18n/fr.po +1 -0
- odoo/addons/web_view_leaflet_map/i18n/it.po +1 -0
- odoo/addons/web_view_leaflet_map/i18n/web_view_leaflet_map.pot +1 -8
- odoo/addons/web_view_leaflet_map/models/ir_ui_view.py +3 -0
- odoo/addons/web_view_leaflet_map/readme/CONFIGURE.md +1 -0
- odoo/addons/web_view_leaflet_map/readme/CONTRIBUTORS.md +1 -0
- odoo/addons/web_view_leaflet_map/readme/DESCRIPTION.md +13 -0
- odoo/addons/web_view_leaflet_map/readme/DEVELOP.md +53 -0
- odoo/addons/web_view_leaflet_map/readme/ROADMAP.md +8 -0
- odoo/addons/web_view_leaflet_map/static/description/index.html +82 -92
- odoo/addons/web_view_leaflet_map/static/src/components/map-component/map_view.esm.js +329 -0
- odoo/addons/web_view_leaflet_map/static/src/components/map-component/map_view.xml +19 -0
- {odoo_addon_web_view_leaflet_map-16.0.2.0.0.1.dist-info → odoo_addon_web_view_leaflet_map-18.0.1.0.0.3.dist-info}/METADATA +81 -82
- odoo_addon_web_view_leaflet_map-18.0.1.0.0.3.dist-info/RECORD +26 -0
- {odoo_addon_web_view_leaflet_map-16.0.2.0.0.1.dist-info → odoo_addon_web_view_leaflet_map-18.0.1.0.0.3.dist-info}/WHEEL +1 -1
- odoo_addon_web_view_leaflet_map-18.0.1.0.0.3.dist-info/top_level.txt +1 -0
- odoo/addons/web_view_leaflet_map/readme/CONFIGURE.rst +0 -1
- odoo/addons/web_view_leaflet_map/readme/CONTRIBUTORS.rst +0 -1
- odoo/addons/web_view_leaflet_map/readme/DESCRIPTION.rst +0 -11
- odoo/addons/web_view_leaflet_map/readme/DEVELOP.rst +0 -62
- odoo/addons/web_view_leaflet_map/readme/ROADMAP.rst +0 -8
- odoo/addons/web_view_leaflet_map/static/src/js/view/map/map_renderer.js +0 -178
- odoo/addons/web_view_leaflet_map/static/src/js/view/map/map_view.js +0 -34
- odoo/addons/web_view_leaflet_map/static/src/js/view/view_registry.js +0 -8
- odoo_addon_web_view_leaflet_map-16.0.2.0.0.1.dist-info/RECORD +0 -27
- odoo_addon_web_view_leaflet_map-16.0.2.0.0.1.dist-info/top_level.txt +0 -1
- /odoo/addons/web_view_leaflet_map/static/src/{css → components/map-component}/web_view_leaflet_map.css +0 -0
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: odoo-addon-web_view_leaflet_map
|
|
3
|
-
Version:
|
|
3
|
+
Version: 18.0.1.0.0.3
|
|
4
|
+
Requires-Python: >=3.10
|
|
5
|
+
Requires-Dist: odoo-addon-web_leaflet_lib==18.0.*
|
|
6
|
+
Requires-Dist: odoo==18.0.*
|
|
4
7
|
Summary: Add new 'leaflet_map' view, to display markers.
|
|
5
8
|
Home-page: https://github.com/OCA/geospatial
|
|
9
|
+
License: AGPL-3
|
|
6
10
|
Author: GRAP, Odoo Community Association (OCA)
|
|
7
11
|
Author-email: support@odoo-community.org
|
|
8
|
-
License: AGPL-3
|
|
9
12
|
Classifier: Programming Language :: Python
|
|
10
13
|
Classifier: Framework :: Odoo
|
|
11
|
-
Classifier: Framework :: Odoo ::
|
|
14
|
+
Classifier: Framework :: Odoo :: 18.0
|
|
12
15
|
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
|
|
13
16
|
Classifier: Development Status :: 3 - Alpha
|
|
14
|
-
|
|
15
|
-
Requires-Dist: odoo-addon-web-leaflet-lib<16.1dev,>=16.0dev
|
|
16
|
-
Requires-Dist: odoo<16.1dev,>=16.0a
|
|
17
|
+
Description-Content-Type: text/x-rst
|
|
17
18
|
|
|
18
19
|
================================
|
|
19
20
|
Leaflet Map View (OpenStreetMap)
|
|
@@ -24,7 +25,7 @@ Leaflet Map View (OpenStreetMap)
|
|
|
24
25
|
!! This file is generated by oca-gen-addon-readme !!
|
|
25
26
|
!! changes will be overwritten. !!
|
|
26
27
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
27
|
-
!! source digest: sha256:
|
|
28
|
+
!! source digest: sha256:52ae60ed2032c73f0ba6fc8ca70e2a2fc73bb12745aeeda793042efb1175c1b9
|
|
28
29
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
29
30
|
|
|
30
31
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
|
|
@@ -34,28 +35,34 @@ Leaflet Map View (OpenStreetMap)
|
|
|
34
35
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
|
35
36
|
:alt: License: AGPL-3
|
|
36
37
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fgeospatial-lightgray.png?logo=github
|
|
37
|
-
:target: https://github.com/OCA/geospatial/tree/
|
|
38
|
+
:target: https://github.com/OCA/geospatial/tree/18.0/web_view_leaflet_map
|
|
38
39
|
:alt: OCA/geospatial
|
|
39
40
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
|
40
|
-
:target: https://translation.odoo-community.org/projects/geospatial-
|
|
41
|
+
:target: https://translation.odoo-community.org/projects/geospatial-18-0/geospatial-18-0-web_view_leaflet_map
|
|
41
42
|
:alt: Translate me on Weblate
|
|
42
43
|
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
|
43
|
-
:target: https://runboat.odoo-community.org/builds?repo=OCA/geospatial&target_branch=
|
|
44
|
+
:target: https://runboat.odoo-community.org/builds?repo=OCA/geospatial&target_branch=18.0
|
|
44
45
|
:alt: Try me on Runboat
|
|
45
46
|
|
|
46
47
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|
47
48
|
|
|
48
|
-
This module extends odoo views, to add a new kind of view, named
|
|
49
|
-
that is using the Leaflet javascript library to use
|
|
50
|
-
This library is for exemple, used in the
|
|
49
|
+
This module extends odoo views, to add a new kind of view, named
|
|
50
|
+
``leaflet_map`` that is using the Leaflet javascript library to use
|
|
51
|
+
maps. (https://leafletjs.com/) This library is for exemple, used in the
|
|
52
|
+
OpenStreetMap project. (https://www.openstreetmap.org/)
|
|
53
|
+
|
|
54
|
+
You can see a simple usage in the module
|
|
55
|
+
``web_view_leaflet_map_partner`` in the same OCA repository that
|
|
56
|
+
displays your contact in a map, if latitude and longitude are defined.
|
|
57
|
+
(To define latitude and longitude, refer to the Odoo module
|
|
58
|
+
``base_geolocalize``)
|
|
51
59
|
|
|
52
|
-
|
|
53
|
-
same OCA repository that displays your contact in a map, if latitude and longitude are
|
|
54
|
-
defined. (To define latitude and longitude, refer to the Odoo module ``base_geolocalize``)
|
|
60
|
+
|image1|
|
|
55
61
|
|
|
56
|
-
|
|
62
|
+
|image2|
|
|
57
63
|
|
|
58
|
-
..
|
|
64
|
+
.. |image1| image:: https://raw.githubusercontent.com/OCA/geospatial/18.0/web_view_leaflet_map/static/description/view_res_partner_map_1.png
|
|
65
|
+
.. |image2| image:: https://raw.githubusercontent.com/OCA/geospatial/18.0/web_view_leaflet_map/static/description/view_res_partner_map_2.png
|
|
59
66
|
|
|
60
67
|
.. IMPORTANT::
|
|
61
68
|
This is an alpha version, the data model and design can change at any time without warning.
|
|
@@ -70,85 +77,77 @@ defined. (To define latitude and longitude, refer to the Odoo module ``base_geol
|
|
|
70
77
|
Configuration
|
|
71
78
|
=============
|
|
72
79
|
|
|
73
|
-
|
|
80
|
+
- See configuration of the module ``web_leaflet_lib``.
|
|
74
81
|
|
|
75
82
|
Development
|
|
76
83
|
===========
|
|
77
84
|
|
|
78
85
|
Create a new view :
|
|
79
86
|
|
|
80
|
-
.. code
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
1. FIELD_LATITUDE and FIELD_LONGITUDE are the name of the fields that
|
|
87
|
+
.. code:: xml
|
|
88
|
+
|
|
89
|
+
<record id="view_my_model_map" model="ir.ui.view">
|
|
90
|
+
<field name="model">my.model</field>
|
|
91
|
+
<field name="arch" type="xml">
|
|
92
|
+
<leaflet_map
|
|
93
|
+
field_latitude="FIELD_LATITUDE"
|
|
94
|
+
field_longitude="FIELD_LONGITUDE"
|
|
95
|
+
field_title="FIELD_TITLE"
|
|
96
|
+
field_address="FIELD_ADDRESS"
|
|
97
|
+
field_marker_icon_image="FIELD_MARKER_ICON_IMAGE"
|
|
98
|
+
>
|
|
99
|
+
<field name="__last_update"/>
|
|
100
|
+
<field name="FIELD_LATITUDE"/>
|
|
101
|
+
<field name="FIELD_LONGITUDE"/>
|
|
102
|
+
<field name="FIELD_TITLE"/>
|
|
103
|
+
<field name="FIELD_ADDRESS"/>
|
|
104
|
+
</leaflet_map>
|
|
105
|
+
</field>
|
|
106
|
+
</record>
|
|
107
|
+
|
|
108
|
+
1. FIELD_LATITUDE and FIELD_LONGITUDE are the name of the fields that
|
|
109
|
+
contains GPS coordinates of the model.
|
|
102
110
|
2. FIELD_TITLE will be used when the popup is displayed, as a title.
|
|
103
|
-
3. FIELD_ADDRESS will be used when the popup is displayed to display the
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
Note: You can set extra settings
|
|
107
|
-
|
|
108
|
-
the
|
|
111
|
+
3. FIELD_ADDRESS will be used when the popup is displayed to display the
|
|
112
|
+
adress.
|
|
113
|
+
4. (optional) FIELD_MARKER_ICON_IMAGE, is the name of the image field to
|
|
114
|
+
place as an icon of the marker. Note: You can set extra settings
|
|
115
|
+
``marker_icon_size_x``, ``marker_icon_size_y``, to define the size of
|
|
116
|
+
the image, and ``marker_popup_anchor_x``, ``marker_popup_anchor_y``
|
|
117
|
+
to define the position of the popup.
|
|
109
118
|
|
|
110
119
|
Map options :
|
|
111
120
|
|
|
112
121
|
- ``default_zoom`` : define the default zoom value. (7 if not defined)
|
|
113
122
|
- ``max_zoom`` : define the max zoom value. (19 if not defined)
|
|
114
|
-
- ``zoom_snap`` : define the zoom level in each change. (1 if not
|
|
115
|
-
|
|
116
|
-
|
|
123
|
+
- ``zoom_snap`` : define the zoom level in each change. (1 if not
|
|
124
|
+
defined)
|
|
125
|
+
- Create or update an action for the model
|
|
117
126
|
|
|
118
|
-
.. code
|
|
127
|
+
.. code:: xml
|
|
119
128
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
**Library Update**
|
|
125
|
-
|
|
126
|
-
For the time being, the module embed the lealflet.js library version 1.8.0 ( released on April 18, 2022.)
|
|
127
|
-
|
|
128
|
-
If a new release is out:
|
|
129
|
-
|
|
130
|
-
- please download it here https://leafletjs.com/download.html
|
|
131
|
-
- update the javascript, css and images, present in the folder ``static/lib/leaflet``
|
|
132
|
-
- test the features
|
|
133
|
-
- make a Pull Request
|
|
129
|
+
<record id="my_module.action_my_model" model="ir.actions.act_window">
|
|
130
|
+
<field name="view_mode">tree,form,leaflet_map</field>
|
|
131
|
+
</record>
|
|
134
132
|
|
|
135
133
|
**Default position in the map**
|
|
136
134
|
|
|
137
|
-
By default, the position of the map is defined by the user, in the
|
|
138
|
-
``get_default_leaflet_position``. It returns the position of
|
|
139
|
-
you can overload this function
|
|
135
|
+
By default, the position of the map is defined by the user, in the
|
|
136
|
+
function ``get_default_leaflet_position``. It returns the position of
|
|
137
|
+
the current company, if defined. you can overload this function
|
|
138
|
+
globally, or per model.
|
|
140
139
|
|
|
141
140
|
Known issues / Roadmap
|
|
142
141
|
======================
|
|
143
142
|
|
|
144
|
-
|
|
145
|
-
is required. We should investigate why and try to
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if longitude and latitude are available. We could imagine other
|
|
150
|
-
with Polylines, Polygons, etc...
|
|
151
|
-
|
|
143
|
+
- For the time being, at the start of the map loading, the call of
|
|
144
|
+
``invalidateSize()`` is required. We should investigate why and try to
|
|
145
|
+
remove that call. see
|
|
146
|
+
https://github.com/Leaflet/Leaflet/issues/3002#issuecomment-93836022
|
|
147
|
+
- For the time being, the map has "Markers" and allow to display odoo
|
|
148
|
+
items if longitude and latitude are available. We could imagine other
|
|
149
|
+
kind of usages, with Polylines, Polygons, etc... See all the leaflet
|
|
150
|
+
options : https://leafletjs.com/reference.html
|
|
152
151
|
|
|
153
152
|
Bug Tracker
|
|
154
153
|
===========
|
|
@@ -156,7 +155,7 @@ Bug Tracker
|
|
|
156
155
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/geospatial/issues>`_.
|
|
157
156
|
In case of trouble, please check there if your issue has already been reported.
|
|
158
157
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
|
159
|
-
`feedback <https://github.com/OCA/geospatial/issues/new?body=module:%20web_view_leaflet_map%0Aversion:%
|
|
158
|
+
`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**>`_.
|
|
160
159
|
|
|
161
160
|
Do not contact contributors directly about support or help with technical issues.
|
|
162
161
|
|
|
@@ -164,17 +163,17 @@ Credits
|
|
|
164
163
|
=======
|
|
165
164
|
|
|
166
165
|
Authors
|
|
167
|
-
|
|
166
|
+
-------
|
|
168
167
|
|
|
169
168
|
* GRAP
|
|
170
169
|
|
|
171
170
|
Contributors
|
|
172
|
-
|
|
171
|
+
------------
|
|
173
172
|
|
|
174
|
-
|
|
173
|
+
- Sylvain LE GAL (https://www.twitter.com/legalsylvain)
|
|
175
174
|
|
|
176
175
|
Maintainers
|
|
177
|
-
|
|
176
|
+
-----------
|
|
178
177
|
|
|
179
178
|
This module is maintained by the OCA.
|
|
180
179
|
|
|
@@ -194,6 +193,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
|
|
194
193
|
|
|
195
194
|
|maintainer-legalsylvain|
|
|
196
195
|
|
|
197
|
-
This module is part of the `OCA/geospatial <https://github.com/OCA/geospatial/tree/
|
|
196
|
+
This module is part of the `OCA/geospatial <https://github.com/OCA/geospatial/tree/18.0/web_view_leaflet_map>`_ project on GitHub.
|
|
198
197
|
|
|
199
198
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
odoo/addons/web_view_leaflet_map/README.rst,sha256=qQgi_29jf5QVJRk3nRgYv9ntRD5-MZuUhhqaJL3KGN8,6867
|
|
2
|
+
odoo/addons/web_view_leaflet_map/__init__.py,sha256=lHbcD_3Jhk02gKyANjQ1Bif8uknO8qLtRSK4lJNPeeQ,55
|
|
3
|
+
odoo/addons/web_view_leaflet_map/__manifest__.py,sha256=PX8hMRBFCuHVYI9lOzPV3gSA4yIZJVbSOQFkLXOqz-Y,1052
|
|
4
|
+
odoo/addons/web_view_leaflet_map/hooks.py,sha256=VWhMUWedPCg8oZxqJCladNBaU9NvJMBJI6BlYKXNcEM,685
|
|
5
|
+
odoo/addons/web_view_leaflet_map/i18n/fr.po,sha256=xSXoIxogfegwOztumHeW5R4xxUooxHsDPCcoqQEgm0k,2102
|
|
6
|
+
odoo/addons/web_view_leaflet_map/i18n/it.po,sha256=RjAJVMbLRt2eJZ-YG2gb_yGGEfB9idHfZZt7Y_ehU0Y,1761
|
|
7
|
+
odoo/addons/web_view_leaflet_map/i18n/web_view_leaflet_map.pot,sha256=GRdgXiphYPs5XratOBcLF4t50oeVlIt56N8ieFm0FHU,1291
|
|
8
|
+
odoo/addons/web_view_leaflet_map/models/__init__.py,sha256=K0P7QAr_t6UHNt0nbpDhqpH4-zILR1hpfNip3VUtouc,82
|
|
9
|
+
odoo/addons/web_view_leaflet_map/models/ir_act_window_view.py,sha256=NfjklK_VNBCuuXn0X22uQzWr9iOJWeT2oN-qXwwDhqQ,499
|
|
10
|
+
odoo/addons/web_view_leaflet_map/models/ir_ui_view.py,sha256=6K_zmkC44ymIDNycqo2KxFq3brsrd6tvm_JpjIlebdw,518
|
|
11
|
+
odoo/addons/web_view_leaflet_map/models/res_users.py,sha256=SmYcwiVXifiT8pDlb1pdAYnlvnodZ8oOrJHr6GQlle4,545
|
|
12
|
+
odoo/addons/web_view_leaflet_map/readme/CONFIGURE.md,sha256=X0jv_nRhCoSaQ3ZqwOqr8g03pGHv-elXfhX6gIN4ilg,53
|
|
13
|
+
odoo/addons/web_view_leaflet_map/readme/CONTRIBUTORS.md,sha256=MBsB-NNU4QMO7gTa_ZRympiiIQwyMPYqq4M3-PbwbHM,58
|
|
14
|
+
odoo/addons/web_view_leaflet_map/readme/DESCRIPTION.md,sha256=Ubg66tabR4lkMIhbfKTQqyl33dOHRLXlIgYe1ReZv_E,629
|
|
15
|
+
odoo/addons/web_view_leaflet_map/readme/DEVELOP.md,sha256=kiVt9qT6SC6Uh9fY0qqSpaI9HSeC67Ppi0b7O7iGPfg,1968
|
|
16
|
+
odoo/addons/web_view_leaflet_map/readme/ROADMAP.md,sha256=PuCMzJS_OKS0w9YBe1r4k3sIJnuvhcrS7qiuUwzwBzk,499
|
|
17
|
+
odoo/addons/web_view_leaflet_map/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
|
|
18
|
+
odoo/addons/web_view_leaflet_map/static/description/index.html,sha256=Jc3I2a281fa5S5Vh0_Q5UC4wfeoj_cTNyLNLuYf6FhU,19285
|
|
19
|
+
odoo/addons/web_view_leaflet_map/static/description/res_partner_map.png,sha256=vyOw2l7n7k4-jYgTT-r31vA4h8kSnjMo0WW0iNEzRi4,390800
|
|
20
|
+
odoo/addons/web_view_leaflet_map/static/src/components/map-component/map_view.esm.js,sha256=LjmqpLMgkiDOW5y3Y9nD5m6YKySBLPAcQ6mTMQwWRX0,10459
|
|
21
|
+
odoo/addons/web_view_leaflet_map/static/src/components/map-component/map_view.xml,sha256=bVHRZOFSKUDKBybx0BzZRgwgJh7DvlKtsMI2fNhrqrc,586
|
|
22
|
+
odoo/addons/web_view_leaflet_map/static/src/components/map-component/web_view_leaflet_map.css,sha256=Tp3SfDNuSPCN32sh_HlSmiF3AYWlvxlzSp8u3NCAHiA,1527
|
|
23
|
+
odoo_addon_web_view_leaflet_map-18.0.1.0.0.3.dist-info/METADATA,sha256=YOFX7HNhXgVfklBDSzUoQfPvgF0x_flwFDaZRsAWxek,7526
|
|
24
|
+
odoo_addon_web_view_leaflet_map-18.0.1.0.0.3.dist-info/WHEEL,sha256=ZhOvUsYhy81Dx67gN3TV0RchQWBIIzutDZaJODDg2Vo,81
|
|
25
|
+
odoo_addon_web_view_leaflet_map-18.0.1.0.0.3.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
|
|
26
|
+
odoo_addon_web_view_leaflet_map-18.0.1.0.0.3.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
odoo
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
* See configuration of the module ``web_leaflet_lib``.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
This module extends odoo views, to add a new kind of view, named ``leaflet_map``
|
|
2
|
-
that is using the Leaflet javascript library to use maps. (https://leafletjs.com/)
|
|
3
|
-
This library is for exemple, used in the OpenStreetMap project. (https://www.openstreetmap.org/)
|
|
4
|
-
|
|
5
|
-
You can see a simple usage in the module ``web_view_leaflet_map_partner`` in the
|
|
6
|
-
same OCA repository that displays your contact in a map, if latitude and longitude are
|
|
7
|
-
defined. (To define latitude and longitude, refer to the Odoo module ``base_geolocalize``)
|
|
8
|
-
|
|
9
|
-
.. figure:: ../static/description/view_res_partner_map_1.png
|
|
10
|
-
|
|
11
|
-
.. figure:: ../static/description/view_res_partner_map_2.png
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
Create a new view :
|
|
2
|
-
|
|
3
|
-
.. code-block:: xml
|
|
4
|
-
|
|
5
|
-
<record id="view_my_model_map" model="ir.ui.view">
|
|
6
|
-
<field name="model">my.model</field>
|
|
7
|
-
<field name="arch" type="xml">
|
|
8
|
-
<leaflet_map
|
|
9
|
-
field_latitude="FIELD_LATITUDE"
|
|
10
|
-
field_longitude="FIELD_LONGITUDE"
|
|
11
|
-
field_title="FIELD_TITLE"
|
|
12
|
-
field_address="FIELD_ADDRESS"
|
|
13
|
-
field_marker_icon_image="FIELD_MARKER_ICON_IMAGE"
|
|
14
|
-
>
|
|
15
|
-
<field name="__last_update"/>
|
|
16
|
-
<field name="FIELD_LATITUDE"/>
|
|
17
|
-
<field name="FIELD_LONGITUDE"/>
|
|
18
|
-
<field name="FIELD_TITLE"/>
|
|
19
|
-
<field name="FIELD_ADDRESS"/>
|
|
20
|
-
</leaflet_map>
|
|
21
|
-
</field>
|
|
22
|
-
</record>
|
|
23
|
-
|
|
24
|
-
1. FIELD_LATITUDE and FIELD_LONGITUDE are the name of the fields that contains GPS coordinates of the model.
|
|
25
|
-
2. FIELD_TITLE will be used when the popup is displayed, as a title.
|
|
26
|
-
3. FIELD_ADDRESS will be used when the popup is displayed to display the adress.
|
|
27
|
-
4. (optional) FIELD_MARKER_ICON_IMAGE, is the name of the image field to place as an icon
|
|
28
|
-
of the marker.
|
|
29
|
-
Note: You can set extra settings ``marker_icon_size_x``, ``marker_icon_size_y``, to define
|
|
30
|
-
the size of the image, and ``marker_popup_anchor_x``, ``marker_popup_anchor_y`` to define
|
|
31
|
-
the position of the popup.
|
|
32
|
-
|
|
33
|
-
Map options :
|
|
34
|
-
|
|
35
|
-
- ``default_zoom`` : define the default zoom value. (7 if not defined)
|
|
36
|
-
- ``max_zoom`` : define the max zoom value. (19 if not defined)
|
|
37
|
-
- ``zoom_snap`` : define the zoom level in each change. (1 if not defined)
|
|
38
|
-
|
|
39
|
-
* Create or update an action for the model
|
|
40
|
-
|
|
41
|
-
.. code-block:: xml
|
|
42
|
-
|
|
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
|
-
**Library Update**
|
|
48
|
-
|
|
49
|
-
For the time being, the module embed the lealflet.js library version 1.8.0 ( released on April 18, 2022.)
|
|
50
|
-
|
|
51
|
-
If a new release is out:
|
|
52
|
-
|
|
53
|
-
- please download it here https://leafletjs.com/download.html
|
|
54
|
-
- update the javascript, css and images, present in the folder ``static/lib/leaflet``
|
|
55
|
-
- test the features
|
|
56
|
-
- make a Pull Request
|
|
57
|
-
|
|
58
|
-
**Default position in the map**
|
|
59
|
-
|
|
60
|
-
By default, the position of the map is defined by the user, in the function
|
|
61
|
-
``get_default_leaflet_position``. It returns the position of the current company, if defined.
|
|
62
|
-
you can overload this function globally, or per model.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
* For the time being, at the start of the map loading, the call of ``invalidateSize()``
|
|
2
|
-
is required. We should investigate why and try to remove that call.
|
|
3
|
-
see https://github.com/Leaflet/Leaflet/issues/3002#issuecomment-93836022
|
|
4
|
-
|
|
5
|
-
* For the time being, the map has "Markers" and allow to display odoo items
|
|
6
|
-
if longitude and latitude are available. We could imagine other kind of usages,
|
|
7
|
-
with Polylines, Polygons, etc...
|
|
8
|
-
See all the leaflet options : https://leafletjs.com/reference.html
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
odoo.define("web_view_leaflet_map.MapRenderer", function (require) {
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var AbstractRenderer = require("web.AbstractRenderer");
|
|
5
|
-
var session = require("web.session");
|
|
6
|
-
var field_utils = require("web.field_utils");
|
|
7
|
-
|
|
8
|
-
var MapRenderer = AbstractRenderer.extend({
|
|
9
|
-
tagName: "div",
|
|
10
|
-
className: "o_leaflet_main_container",
|
|
11
|
-
|
|
12
|
-
init: function (parent, state, params) {
|
|
13
|
-
this._super.apply(this, arguments);
|
|
14
|
-
|
|
15
|
-
this.leaflet_tile_url = session["leaflet.tile_url"];
|
|
16
|
-
this.leaflet_copyright = session["leaflet.copyright"];
|
|
17
|
-
this.default_zoom = params.arch.attrs.default_zoom || 7;
|
|
18
|
-
this.max_zoom = params.arch.attrs.max_zoom || 19;
|
|
19
|
-
this.zoom_snap = params.arch.attrs.zoom_snap | 1;
|
|
20
|
-
this.field_latitude = params.arch.attrs.field_latitude;
|
|
21
|
-
this.field_longitude = params.arch.attrs.field_longitude;
|
|
22
|
-
this.field_title = params.arch.attrs.field_title;
|
|
23
|
-
this.field_address = params.arch.attrs.field_address;
|
|
24
|
-
this.field_marker_icon_image = params.arch.attrs.field_marker_icon_image;
|
|
25
|
-
this.marker_icon_size_x = params.arch.attrs.marker_icon_size_x || 64;
|
|
26
|
-
this.marker_icon_size_y = params.arch.attrs.marker_icon_size_y || 64;
|
|
27
|
-
this.marker_popup_anchor_x = params.arch.attrs.marker_popup_anchor_x || 0;
|
|
28
|
-
this.marker_popup_anchor_y = params.arch.attrs.marker_popup_anchor_y || -32;
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
start: function () {
|
|
32
|
-
var self = this;
|
|
33
|
-
var self_super = this._super;
|
|
34
|
-
return this._initDefaultPosition()
|
|
35
|
-
.then(function () {
|
|
36
|
-
self._initMap();
|
|
37
|
-
})
|
|
38
|
-
.then(function () {
|
|
39
|
-
return self_super.apply(self, arguments);
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
_render: function () {
|
|
44
|
-
var self = this;
|
|
45
|
-
|
|
46
|
-
// First remove previous layer that contains
|
|
47
|
-
// all the previously rendered records
|
|
48
|
-
if (this.leaflet_layer_group) {
|
|
49
|
-
this.leaflet_map.removeLayer(this.leaflet_layer_group);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Create a new layer and render fresh records
|
|
53
|
-
this.leaflet_layer_group = L.layerGroup().addTo(this.leaflet_map);
|
|
54
|
-
_.each(this.state.data, function (record) {
|
|
55
|
-
self._renderRecord(record);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// Delay and call invalidateSize() to display correctly
|
|
59
|
-
// the map. See.
|
|
60
|
-
// https://github.com/Leaflet/Leaflet/issues/3002#issuecomment-93836022
|
|
61
|
-
return this._super.apply(this, arguments).then(function () {
|
|
62
|
-
window.setTimeout(function () {
|
|
63
|
-
self.leaflet_map.invalidateSize();
|
|
64
|
-
}, 1);
|
|
65
|
-
});
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
_renderRecord: function (record) {
|
|
69
|
-
var self = this;
|
|
70
|
-
var latlng = L.latLng(
|
|
71
|
-
record.data[this.field_latitude],
|
|
72
|
-
record.data[this.field_longitude]
|
|
73
|
-
);
|
|
74
|
-
// Display only records that have a valid position
|
|
75
|
-
if (latlng.lat !== 0 && latlng.lng !== 0) {
|
|
76
|
-
// Create marker
|
|
77
|
-
var markerOptions = this._prepareMarkerOptions(record);
|
|
78
|
-
var marker = L.marker(latlng, markerOptions).addTo(
|
|
79
|
-
this.leaflet_layer_group
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
// Create Popup and attach an event onclick
|
|
83
|
-
var popup = L.popup().setContent(this._preparePopUpData(record));
|
|
84
|
-
|
|
85
|
-
marker.bindPopup(popup).on("popupopen", () => {
|
|
86
|
-
$(".o_map_selector").parent().parent().click(
|
|
87
|
-
{
|
|
88
|
-
model_name: record.model,
|
|
89
|
-
res_id: record.data.id,
|
|
90
|
-
current_object: self,
|
|
91
|
-
},
|
|
92
|
-
self._onClickLeafletPopup
|
|
93
|
-
);
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
_onClickLeafletPopup: function (ev) {
|
|
99
|
-
ev.preventDefault();
|
|
100
|
-
ev.data.current_object.trigger_up("switch_view", {
|
|
101
|
-
view_type: "form",
|
|
102
|
-
res_id: ev.data.res_id,
|
|
103
|
-
model: ev.data.model_name,
|
|
104
|
-
});
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
_prepareMarkerIcon: function (record) {
|
|
108
|
-
var myIcon = L.icon({
|
|
109
|
-
iconUrl: session.url("/web/image", {
|
|
110
|
-
model: record.model,
|
|
111
|
-
id: JSON.stringify(record.data.id),
|
|
112
|
-
field: this.field_marker_icon_image,
|
|
113
|
-
// Unique forces a reload of the image when the record has been updated
|
|
114
|
-
unique: field_utils.format
|
|
115
|
-
.datetime(record.data.__last_update)
|
|
116
|
-
.replace(/[^0-9]/g, ""),
|
|
117
|
-
}),
|
|
118
|
-
className: "leaflet_marker_icon",
|
|
119
|
-
iconSize: [this.marker_icon_size_x, this.marker_icon_size_y],
|
|
120
|
-
popupAnchor: [this.marker_popup_anchor_x, this.marker_popup_anchor_y],
|
|
121
|
-
});
|
|
122
|
-
return myIcon;
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
_prepareMarkerOptions: function (record) {
|
|
126
|
-
var icon = this._prepareMarkerIcon(record);
|
|
127
|
-
var result = {
|
|
128
|
-
title: record.data[this.field_title],
|
|
129
|
-
alt: record.data[this.field_title],
|
|
130
|
-
riseOnHover: true,
|
|
131
|
-
};
|
|
132
|
-
if (icon) {
|
|
133
|
-
result.icon = icon;
|
|
134
|
-
}
|
|
135
|
-
return result;
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
_preparePopUpData: function (record) {
|
|
139
|
-
return (
|
|
140
|
-
"<div class='o_map_selector' res_id='" +
|
|
141
|
-
record.data.id +
|
|
142
|
-
"'>" +
|
|
143
|
-
"<b>" +
|
|
144
|
-
record.data[this.field_title] +
|
|
145
|
-
"</b><br/>" +
|
|
146
|
-
" - " +
|
|
147
|
-
record.data[this.field_address] +
|
|
148
|
-
"</div>"
|
|
149
|
-
);
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
_initDefaultPosition: function () {
|
|
153
|
-
var self = this;
|
|
154
|
-
return this._rpc({
|
|
155
|
-
model: "res.users",
|
|
156
|
-
method: "get_default_leaflet_position",
|
|
157
|
-
args: [this.state.model],
|
|
158
|
-
}).then(function (result) {
|
|
159
|
-
self.default_lat_lng = L.latLng(result.lat, result.lng);
|
|
160
|
-
});
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
_initMap: function () {
|
|
164
|
-
var $mainDiv = $("<div id='div_map' class='o_leaflet_map_container'/>");
|
|
165
|
-
this.leaflet_container = $mainDiv[0];
|
|
166
|
-
this.leaflet_map = L.map(this.leaflet_container, {
|
|
167
|
-
zoomSnap: this.zoom_snap,
|
|
168
|
-
}).setView(this.default_lat_lng, this.default_zoom);
|
|
169
|
-
this.leaflet_tiles = L.tileLayer(this.leaflet_tile_url, {
|
|
170
|
-
maxZoom: this.max_zoom,
|
|
171
|
-
attribution: this.leaflet_copyright,
|
|
172
|
-
}).addTo(this.leaflet_map);
|
|
173
|
-
this.$el.append($mainDiv);
|
|
174
|
-
},
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
return MapRenderer;
|
|
178
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
odoo.define("web_view_leaflet_map.MapView", function (require) {
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var BasicView = require("web.BasicView");
|
|
5
|
-
var core = require("web.core");
|
|
6
|
-
var MapRenderer = require("web_view_leaflet_map.MapRenderer");
|
|
7
|
-
var _lt = core._lt;
|
|
8
|
-
|
|
9
|
-
var MapView = BasicView.extend({
|
|
10
|
-
accesskey: "m",
|
|
11
|
-
display_name: _lt("Map"),
|
|
12
|
-
icon: "fa fa-map-o",
|
|
13
|
-
config: _.extend({}, BasicView.prototype.config, {
|
|
14
|
-
Renderer: MapRenderer,
|
|
15
|
-
}),
|
|
16
|
-
viewType: "leaflet_map",
|
|
17
|
-
searchMenuTypes: ["filter", "favorite"],
|
|
18
|
-
|
|
19
|
-
init: function (viewInfo, params) {
|
|
20
|
-
this._super.apply(this, arguments);
|
|
21
|
-
|
|
22
|
-
var mode =
|
|
23
|
-
this.arch.attrs.editable && !params.readonly ? "edit" : "readonly";
|
|
24
|
-
|
|
25
|
-
this.controllerParams.mode = mode;
|
|
26
|
-
this.rendererParams.arch = this.arch;
|
|
27
|
-
|
|
28
|
-
this.loadParams.limit = this.loadParams.limit || 80;
|
|
29
|
-
this.loadParams.type = "list";
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
return MapView;
|
|
34
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
odoo/addons/web_view_leaflet_map/README.rst,sha256=hp2kff2j0OVfSstst-HROIE_pF4uOCDLSMUUBbPzCEo,7201
|
|
2
|
-
odoo/addons/web_view_leaflet_map/__init__.py,sha256=lHbcD_3Jhk02gKyANjQ1Bif8uknO8qLtRSK4lJNPeeQ,55
|
|
3
|
-
odoo/addons/web_view_leaflet_map/__manifest__.py,sha256=pts6vwj0Re4Jnk6XGKbNNhphp6BaVAiHRGPnUTIzhJ8,1076
|
|
4
|
-
odoo/addons/web_view_leaflet_map/hooks.py,sha256=1ljtgfKjP-otnxGEnMbDpb83VRQamicLRhNe96iioB4,682
|
|
5
|
-
odoo/addons/web_view_leaflet_map/i18n/fr.po,sha256=8K853Xh7aSE482dPBdFM-g9kBJYRfy1gOj3qcwiOEx0,2013
|
|
6
|
-
odoo/addons/web_view_leaflet_map/i18n/it.po,sha256=dY7L3duEe86P25t3TahZwVJp3b0NGBdb0FJc47XtnMU,1672
|
|
7
|
-
odoo/addons/web_view_leaflet_map/i18n/web_view_leaflet_map.pot,sha256=QAlBEulNZ97I9e6OEb0-UEnA_0_dc9yza_S12rBQgmA,1455
|
|
8
|
-
odoo/addons/web_view_leaflet_map/models/__init__.py,sha256=K0P7QAr_t6UHNt0nbpDhqpH4-zILR1hpfNip3VUtouc,82
|
|
9
|
-
odoo/addons/web_view_leaflet_map/models/ir_act_window_view.py,sha256=NfjklK_VNBCuuXn0X22uQzWr9iOJWeT2oN-qXwwDhqQ,499
|
|
10
|
-
odoo/addons/web_view_leaflet_map/models/ir_ui_view.py,sha256=lSuUMUNxQsgE8lAVEiDK3RNtaUavmNCIM7F2AUep7dc,404
|
|
11
|
-
odoo/addons/web_view_leaflet_map/models/res_users.py,sha256=SmYcwiVXifiT8pDlb1pdAYnlvnodZ8oOrJHr6GQlle4,545
|
|
12
|
-
odoo/addons/web_view_leaflet_map/readme/CONFIGURE.rst,sha256=8jdJsLPTrE4YaSqWebS8BZffEy6-2-EoD_SxBIfC68s,54
|
|
13
|
-
odoo/addons/web_view_leaflet_map/readme/CONTRIBUTORS.rst,sha256=lOu65FBimdkBCJRQ-0POIP_rRFwZ_plzxBFFLHkxhrQ,56
|
|
14
|
-
odoo/addons/web_view_leaflet_map/readme/DESCRIPTION.rst,sha256=g6qwKngb2Npjk2WhWLXYE5U_ljA1hH5eTmQ0ndq4l08,645
|
|
15
|
-
odoo/addons/web_view_leaflet_map/readme/DEVELOP.rst,sha256=30B5yD29990smVfoaoEPicEfynPL0gzQBFv72Lhd_6E,2415
|
|
16
|
-
odoo/addons/web_view_leaflet_map/readme/ROADMAP.rst,sha256=B8jPgsiSeXhHfZCrf9p5v-iSFVrTYL31-iDbifHm3Zk,496
|
|
17
|
-
odoo/addons/web_view_leaflet_map/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
|
|
18
|
-
odoo/addons/web_view_leaflet_map/static/description/index.html,sha256=0MplKuYJ5vzI0DI-36UZV9da5vFELhVzaJzvgZGwDb4,21168
|
|
19
|
-
odoo/addons/web_view_leaflet_map/static/description/res_partner_map.png,sha256=vyOw2l7n7k4-jYgTT-r31vA4h8kSnjMo0WW0iNEzRi4,390800
|
|
20
|
-
odoo/addons/web_view_leaflet_map/static/src/css/web_view_leaflet_map.css,sha256=Tp3SfDNuSPCN32sh_HlSmiF3AYWlvxlzSp8u3NCAHiA,1527
|
|
21
|
-
odoo/addons/web_view_leaflet_map/static/src/js/view/view_registry.js,sha256=lBbqZDEwa5osnDjaryjbSVeII87oosy4GR0M61sRaok,255
|
|
22
|
-
odoo/addons/web_view_leaflet_map/static/src/js/view/map/map_renderer.js,sha256=f8Y-Q-bys7GzupqPc4MUJjRBuAnDg5o-QWFf9vbeYOM,6934
|
|
23
|
-
odoo/addons/web_view_leaflet_map/static/src/js/view/map/map_view.js,sha256=3HDassi20Lc-q1A90EZAcJD0bE8z_KeRRymGJORxzoM,1022
|
|
24
|
-
odoo_addon_web_view_leaflet_map-16.0.2.0.0.1.dist-info/METADATA,sha256=Un0zaynjKve2Oz2GUCIBcUoCY4DHyXpBBiZZoN1MR-c,7841
|
|
25
|
-
odoo_addon_web_view_leaflet_map-16.0.2.0.0.1.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
26
|
-
odoo_addon_web_view_leaflet_map-16.0.2.0.0.1.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
|
|
27
|
-
odoo_addon_web_view_leaflet_map-16.0.2.0.0.1.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
odoo
|
|
File without changes
|