Skip to content

[20.0][MIG] base_geoengine: Migration to 20.0 - #8

Open
weinni2000 wants to merge 1 commit into
20.0.beforefrom
20.0-mig-base_geoengine
Open

weinni2000 wants to merge 1 commit into
20.0.beforefrom
20.0-mig-base_geoengine

Conversation

@weinni2000

@weinni2000 weinni2000 commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner
  • Convert security/ir.model.access.csv to security/ir.access.csv.
  • Adapt the geo operators to the 20.0 ORM: Domain._to_sql / Field._condition_to_sql take a TableSQL, check_field_access is public, and Query.add_where() gets SQL objects (SQL.identifier) instead of raw strings.
  • where_calc() applies _access_domain("read"), so access rules also restrict the indirect geo sub-queries ({'model.geo_field': domain}); invalid or empty geo references now raise a ValueError.
  • Rewrite the geo domain selector widgets for the 20.0 domain editor (the old field-input / number-field components are replaced by domain_selector_active_ids and a reworked domain_selector_geo_field_input).
  • Adapt the OWL components of the geoengine view (controller, renderer, layers / records panels, search bar, edit map widget) to the 20.0 web client.

Migrated with odev.

Assisted-by: Claude Code (claude-opus-5-5)

Summary by Sourcery

Migrate base_geoengine to Odoo 20.0 while preserving secure geospatial search and modernizing its map views and domain editing experience.

New Features:

  • Add geoengine support for Odoo 20.0 views and action window view modes.
  • Provide updated geo-domain editing with geometry, referenced records, filtered subdomains, and active-record operators.

Bug Fixes:

  • Enforce access rights and record rules in indirect geospatial searches and validate invalid or empty geo references consistently.
  • Prevent geometry parsing and map styling failures for invalid values or small result sets.

Enhancements:

  • Adapt geospatial ORM integration and SQL generation to Odoo 20.0 APIs.
  • Modernize geoengine OWL components, domain widgets, controls, theming, and popup rendering for the Odoo 20.0 web client.

Build:

  • Use PostGIS 16 for development and CI database services.

Tests:

  • Add regression coverage for indirect geo domains, security enforcement, invalid geometry values, empty subdomains, and operator validation.

Chores:

  • Migrate security access definitions and module metadata to the 20.0 format.

@sourcery-ai

sourcery-ai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Expose readable models with stored geo fields for indirect geo-domain selection, and register the GeoEngine view mode through the Odoo 20.0 action-view extension.

  • base_geoengine/models/base.py L24, L134-163
  • base_geoengine/models/ir_actions_act_window_view.py L1-11
  • base_geoengine/models/ir_model.py L6 (removed lines)

Implementation

Adapt domain SQL generation and indirect geo searches to the Odoo 20.0 TableSQL API while enforcing access domains and validating geo references.

  • base_geoengine/domains.py L38-44 (+7 small edits)
  • base_geoengine/expressions.py L64-68, L74-126, L165-203 (+5 small edits)

Update geometry conversion, geo-field validation, and SQL helpers for the migrated ORM and safer input handling.

  • base_geoengine/fields.py L68, L115-126
  • base_geoengine/geo_convertion_helper.py L12, L36-46
  • base_geoengine/geo_db.py L8, L87-94
  • base_geoengine/geo_operators.py L13-17, L25, L51

UI

Replace the legacy geo-domain editor with Odoo 20.0 tree-editor integrations for geo operands, reference-model selection, and active-ID filters.

  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_active_ids/domain_selector_active_ids.esm.js L1-159
  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.esm.js L7-315
  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field_dialog/domain_selector_geo_field_dialog.esm.js L7-65
  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field_input/domain_selector_geo_field_input.esm.js L7-277, L280 (removed lines)
  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field_input/domain_selector_geo_field_input.xml L4-85, L87 (removed lines)
  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_field.esm.js (deleted)
  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input/domain_selector_field_input.esm.js (deleted)
  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input/domain_selector_field_input.xml (deleted)
  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_for_active_ids/domain_selector_field_input_for_active_ids.esm.js (deleted)
  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_for_active_ids/domain_selector_field_input_for_active_ids.xml (deleted)
  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.esm.js (deleted)
  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_field_input_with_tags/domain_selector_field_input_with_tags.xml (deleted)
  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_geo_field/domain_selector_geo_field.xml (deleted)
  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_number_field/domain_selector_number_field.esm.js (deleted)
  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_number_field/domain_selector_number_field.xml (deleted)
  • base_geoengine/static/src/js/widgets/domain_selector_geo_field/domain_selector_operators.esm.js (deleted)

Migrate the GeoEngine view components, stores, panels, renderer, and map widget to the Odoo 20.0 OWL and web-client APIs.

  • base_geoengine/models/geo_vector_layer.py L102-108, L116-126, L131-141 (+1 small edits)
  • base_geoengine/models/ir_view.py L38
  • base_geoengine/static/src/js/raster_layers_store.esm.js L3, L42
  • base_geoengine/static/src/js/vector_layers_store.esm.js L2, L36
  • base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.esm.js L22-28 (+6 small edits)
  • base_geoengine/static/src/js/views/geoengine/geoengine_controller/geoengine_controller.xml L4-12, L32-41 (+2 small edits)
  • base_geoengine/static/src/js/views/geoengine/geoengine_record/geoengine_record.esm.js L12, L25-33
  • base_geoengine/static/src/js/views/geoengine/geoengine_record/geoengine_record.xml L5-9
  • base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.esm.js L55-78, L545-567, L717-734 (+20 small edits)
  • base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.xml L5-8, L16-19, L26-38
  • base_geoengine/static/src/js/views/geoengine/geoengine_view.esm.js L18
  • base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.esm.js L7-12, L17-27, L226-231 (+4 small edits)
  • base_geoengine/static/src/js/views/geoengine/layers_panel/layers_panel.xml L6-20, L54-67, L81-85 (+5 small edits)
  • base_geoengine/static/src/js/views/geoengine/records_panel/records_panel.esm.js L8-21, L81 (removed lines)
  • base_geoengine/static/src/js/views/geoengine/records_panel/records_panel.xml L6-20, L26-33 (+4 small edits)
  • base_geoengine/static/src/js/views/geoengine/records_panel/search_bar_records/search_bar_records.esm.js L7-14, L21, L28 (removed lines)
  • base_geoengine/static/src/js/views/geoengine/records_panel/search_bar_records/search_bar_records.xml L17-21
  • base_geoengine/static/src/js/widgets/geoengine_edit_map/field_geoengine_edit_map.esm.js L13-26 (+4 small edits)
  • base_geoengine/static/src/js/widgets/geoengine_edit_map/field_geoengine_edit_map.xml L4

Update map and legend styling for theme-aware colors and replace legacy controls with current icons.

  • base_geoengine/static/src/css/style.css L179-188
  • base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.scss L28-34, L50, L56

Configuration

Set the module version and access-file manifest entry for Odoo 20.0, and configure PostGIS-backed databases in copier answers and CI.

  • .copier-answers.yml L19
  • .github/workflows/test.yml L49
  • base_geoengine/__manifest__.py L7, L20

Replace the legacy model-access CSV with the Odoo 20.0 access definition file.

  • base_geoengine/security/ir.model.access.csv L1-9

Tests

Cover indirect geo search behavior, invalid references, operator validation, and access restrictions under the migrated ORM.

  • base_geoengine/tests/test_model.py L445-516, L795, L804-826

Other changes

Files not grouped.

  • base_geoengine/models/__init__.py L23

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="base_geoengine/tests/test_model.py" line_range="751-755" />
<code_context>
+                    "operation": "r",
+                },
+                {
+                    "name": "dummy.zip read for admins (test)",
+                    "model_id": model_zip.id,
+                    "group_id": self.env.ref("base.group_system").id,
+                    "operation": "r",
                 },
             ]
         )
</code_context>
<issue_to_address>
**issue (testing):** The restricted test user is granted the custom `Geo Restricted` group, but the new `dummy.zip` model access is granted only to `base.group_system`. The restricted user's search therefore fails the model-level access check with an access error before the record-domain restriction can be evaluated, so the regression test no longer exercises record-rule behavior.

**Triggers:** When `test_geo_search_indirect_respects_record_rules` runs the search as the restricted user.

**Suggested fix:** Grant read access for `dummy.zip` to the restricted test group as well as to the administrator group, using separate non-overlapping access records.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and the change alters model and record-level authorization, including which groups can read geospatial records and how security domains are applied to indirect spatial queries; a mistake could expose records or grant access broadly without an obvious application failure. Reverting the code would not undo any data or access that was already exposed, and database-loaded access changes may require explicit cleanup.

Blocking findings: base_geoengine/tests/test_model.py:755


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread base_geoengine/tests/test_model.py Resolved
@weinni2000 weinni2000 changed the title 20.0 mig base geoengine [20.0][MIG] base_geoengine: Migration to 20.0 Nov 1, 2026
@weinni2000
weinni2000 force-pushed the 20.0-mig-base_geoengine branch from 6b283ce to 16aea17 Compare November 1, 2026 09:16
@weinni2000
weinni2000 force-pushed the 20.0-mig-base_geoengine branch from 16aea17 to 8e99ffa Compare November 1, 2026 09:30
@weinni2000
weinni2000 force-pushed the 20.0-mig-base_geoengine branch 2 times, most recently from 3d3344e to 44a8119 Compare November 10, 2026 08:29
Assisted-by: Claude Code (claude-opus-5-5)
@weinni2000
weinni2000 force-pushed the 20.0-mig-base_geoengine branch from 44a8119 to f54f4f9 Compare November 10, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant