Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion base_geoengine/models/geo_raster_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class GeoRasterLayer(models.Model):
params = fields.Char(help="Dictiorary of values for dimensions as JSON")

# wms options
params_wms = fields.Char(help="Need to provide at least a LAYERS param")
params_wms = fields.Char(
"Params WMS", help="Need to provide at least a LAYERS param"
)
server_type = fields.Char(
help="The type of the remote WMS server: mapserver, \
geoserver, carmentaserver, or qgis",
Expand Down
19 changes: 17 additions & 2 deletions base_geoengine/models/geo_vector_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ class GeoVectorLayer(models.Model):
ondelete="cascade",
domain=[("ttype", "ilike", "geo_")],
)
attribute_field_id = fields.Many2one(
"ir.model.fields", "Attribute field", domain=[("ttype", "in", SUPPORTED_ATT)]

attribute_field_id_domain = fields.Binary(
compute="_compute_attribute_field_id_domain", readonly=True, store=False
)
attribute_field_id = fields.Many2one("ir.model.fields", "Attribute field")

model_id = fields.Many2one(
"ir.model",
"Model to use",
Expand Down Expand Up @@ -155,3 +158,15 @@ def _compute_model_id(self):
rec.model_id = ""
else:
rec.model_id = ""

@api.depends("geo_field_id")
def _compute_attribute_field_id_domain(self):
for rec in self:
rec.attribute_field_id_domain = (
[
("ttype", "in", SUPPORTED_ATT),
("model", "=", rec.geo_field_id.model_id.model),
]
if rec.geo_field_id
else [("ttype", "in", SUPPORTED_ATT)]
)
4 changes: 4 additions & 0 deletions base_geoengine/views/geo_vector_layer_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
<field name="name" />
<field name="view_id" />
<field name="geo_field_id" />
<field name="attribute_field_id_domain" invisible="1" />
<field
name="attribute_field_id"
required="geo_repr in ['choropleth', 'proportion', 'colored']"
domain="attribute_field_id_domain"
/>
<field name="active_on_startup" />
<field name="display_polygon_labels" />
Expand Down Expand Up @@ -82,9 +84,11 @@
<group string="General" col="4">
<field name="name" />
<field name="geo_field_id" />
<field name="attribute_field_id_domain" invisible="1" />
<field
name="attribute_field_id"
required="geo_repr in ['choropleth', 'proportion', 'colored']"
domain="attribute_field_id_domain"
/>
<field name="display_polygon_labels" />
<field name="sequence" readonly="1" />
Expand Down