Skip to content
Open
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
14 changes: 13 additions & 1 deletion base_geoengine/models/ir_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class IrUIView(models.Model):
"geoengine.vector.layer", "view_id", "Vector layers", required=True
)

projection = fields.Char(default="EPSG:3857", required=True)
projection = fields.Char(default="EPSG:3857")
default_extent = fields.Char(
"Default map extent",
default="-123164.85222423, 5574694.9538936, 1578017.6490538,"
Expand All @@ -29,6 +29,18 @@ class IrUIView(models.Model):
default_zoom = fields.Integer("Default map zoom")
restricted_extent = fields.Char("Restricted map extent")

# Using a SQL Constraint
# because adding a new required field to this very low-level module
# might create a race condition during update,
# see https://github.com/odoo/odoo/issues/286530.
_sql_constraints = [
(
"geoengine_projection_required",
"CHECK(type <> 'geoengine' OR COALESCE(projection, '') <> '')",
"A GeoEngine view must have a Projection.",
),
]

def _is_qweb_based_view(self, view_type):
if view_type == "geoengine":
return True
Expand Down
Loading