odoo-addon-web-view-leaflet-map 16.0.2.0.0.3__py3-none-any.whl → 18.0.1.0.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 (28) hide show
  1. odoo/addons/web_view_leaflet_map/README.rst +79 -77
  2. odoo/addons/web_view_leaflet_map/__manifest__.py +4 -5
  3. odoo/addons/web_view_leaflet_map/hooks.py +4 -4
  4. odoo/addons/web_view_leaflet_map/i18n/web_view_leaflet_map.pot +1 -9
  5. odoo/addons/web_view_leaflet_map/models/ir_ui_view.py +3 -0
  6. odoo/addons/web_view_leaflet_map/readme/CONFIGURE.md +1 -0
  7. odoo/addons/web_view_leaflet_map/readme/CONTRIBUTORS.md +1 -0
  8. odoo/addons/web_view_leaflet_map/readme/DESCRIPTION.md +13 -0
  9. odoo/addons/web_view_leaflet_map/readme/DEVELOP.md +53 -0
  10. odoo/addons/web_view_leaflet_map/readme/ROADMAP.md +8 -0
  11. odoo/addons/web_view_leaflet_map/static/description/index.html +55 -56
  12. odoo/addons/web_view_leaflet_map/static/src/components/map-component/map_view.esm.js +331 -0
  13. odoo/addons/web_view_leaflet_map/static/src/components/map-component/map_view.xml +19 -0
  14. {odoo_addon_web_view_leaflet_map-16.0.2.0.0.3.dist-info → odoo_addon_web_view_leaflet_map-18.0.1.0.1.dist-info}/METADATA +86 -83
  15. odoo_addon_web_view_leaflet_map-18.0.1.0.1.dist-info/RECORD +26 -0
  16. {odoo_addon_web_view_leaflet_map-16.0.2.0.0.3.dist-info → odoo_addon_web_view_leaflet_map-18.0.1.0.1.dist-info}/WHEEL +1 -1
  17. odoo_addon_web_view_leaflet_map-18.0.1.0.1.dist-info/top_level.txt +1 -0
  18. odoo/addons/web_view_leaflet_map/readme/CONFIGURE.rst +0 -1
  19. odoo/addons/web_view_leaflet_map/readme/CONTRIBUTORS.rst +0 -1
  20. odoo/addons/web_view_leaflet_map/readme/DESCRIPTION.rst +0 -11
  21. odoo/addons/web_view_leaflet_map/readme/DEVELOP.rst +0 -62
  22. odoo/addons/web_view_leaflet_map/readme/ROADMAP.rst +0 -8
  23. odoo/addons/web_view_leaflet_map/static/src/js/view/map/map_renderer.js +0 -178
  24. odoo/addons/web_view_leaflet_map/static/src/js/view/map/map_view.js +0 -34
  25. odoo/addons/web_view_leaflet_map/static/src/js/view/view_registry.js +0 -8
  26. odoo_addon_web_view_leaflet_map-16.0.2.0.0.3.dist-info/RECORD +0 -27
  27. odoo_addon_web_view_leaflet_map-16.0.2.0.0.3.dist-info/top_level.txt +0 -1
  28. /odoo/addons/web_view_leaflet_map/static/src/{css → components/map-component}/web_view_leaflet_map.css +0 -0
@@ -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,8 +0,0 @@
1
- odoo.define("web_view_leaflet_map.view_registry", function (require) {
2
- "use strict";
3
-
4
- var MapView = require("web_view_leaflet_map.MapView");
5
- var view_registry = require("web.view_registry");
6
-
7
- view_registry.add("leaflet_map", MapView);
8
- });
@@ -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=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=F366HXH8JVaf88r3ylbz6G4luSbL9yYBBWXPeQMzoa8,1544
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.3.dist-info/METADATA,sha256=hFRR83DwoDw3g7OWl1mnEDHCtHlllf0kuikrLSgZ4KE,7841
25
- odoo_addon_web_view_leaflet_map-16.0.2.0.0.3.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
26
- odoo_addon_web_view_leaflet_map-16.0.2.0.0.3.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
27
- odoo_addon_web_view_leaflet_map-16.0.2.0.0.3.dist-info/RECORD,,