Skip to content

Commit 3b1faba

Browse files
committed
fix(spp_program_geofence): add GIS view for geofence model and fix menu order
The GeoPolygonField edit widget requires a GIS view (ir.ui.view with type=gis) with data and raster layers to render the map. Without it, opening a geofence form raised "No GIS view defined". Also moved the Geofences menu item to sequence 200 so it appears last in the Area menu.
1 parent d764a57 commit 3b1faba

1 file changed

Lines changed: 37 additions & 2 deletions

File tree

spp_program_geofence/views/geofence_view.xml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,41 @@
8787
</field>
8888
</record>
8989

90+
<!-- Geofence GIS View (required by GeoPolygonField edit widget) -->
91+
<record id="view_geofence_gis" model="ir.ui.view">
92+
<field name="name">spp.gis.geofence.gis</field>
93+
<field eval="16" name="priority" />
94+
<field name="model">spp.gis.geofence</field>
95+
<field name="arch" type="xml">
96+
<gis editable="1">
97+
<field name="id" />
98+
<field name="name" select="1" />
99+
<field name="display_name" />
100+
<field name="geometry" />
101+
</gis>
102+
</field>
103+
</record>
104+
105+
<record id="gis_vector_layer_geofence" model="spp.gis.data.layer">
106+
<field
107+
name="geo_field_id"
108+
ref="spp_gis.field_spp_gis_geofence__geometry"
109+
/>
110+
<field name="name">Geofence Polygons</field>
111+
<field eval="1" name="sequence" />
112+
<field name="view_id" ref="view_geofence_gis" />
113+
<field name="geo_repr">basic</field>
114+
<field name="active_on_startup" eval="True" />
115+
<field name="layer_opacity">0.8</field>
116+
<field name="begin_color">#FF680A</field>
117+
</record>
118+
119+
<record id="gis_raster_layer_geofence" model="spp.gis.raster.layer">
120+
<field name="raster_type">osm</field>
121+
<field name="name">Default</field>
122+
<field name="view_id" ref="view_geofence_gis" />
123+
</record>
124+
90125
<!-- Geofence Action -->
91126
<record id="action_geofence_list" model="ir.actions.act_window">
92127
<field name="name">Geofences</field>
@@ -95,12 +130,12 @@
95130
<field name="search_view_id" ref="view_geofence_search" />
96131
</record>
97132

98-
<!-- Menu: under Area top-level -->
133+
<!-- Menu: last item under Area top-level -->
99134
<menuitem
100135
id="menu_geofence_list"
101136
name="Geofences"
102137
action="action_geofence_list"
103138
parent="spp_area.area_main_top_menu"
104-
sequence="20"
139+
sequence="200"
105140
/>
106141
</odoo>

0 commit comments

Comments
 (0)