Skip to content

[19.0][MIG] base_geoengine_demo: Migration to 19.0 - #9

Open
weinni2000 wants to merge 1 commit into
19.0-mig-base_geoengine_demo-basefrom
19.0-mig-base_geoengine_demo
Open

weinni2000 wants to merge 1 commit into
19.0-mig-base_geoengine_demo-basefrom
19.0-mig-base_geoengine_demo

Conversation

@weinni2000

@weinni2000 weinni2000 commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner
  • _check_the_point: loop over the records instead of reading self.the_point / self.zip_id (failed on multi-record writes), and use self.env._ with a named placeholder (msgid updated in the existing translations).
  • _compute_zip_id: clear zip_id with False instead of 0, which gave the nonexistent record dummy.zip(0,) when the point was removed.
  • Add tests for the zip computation, the total sales and the point/zip constraint.
  • test-requirements.txt: install base_geoengine from the 19.0 migration [19.0][MIG] base_geoengine: consolidated migration OCA/geospatial#465, which is not merged yet.
  • Remove the UPGRADE.md work log of the 18.0 migration ([18.0][MIG] base_geoengine_demo OCA/geospatial#483).

Migrated with odev.

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

Summary by Sourcery

Migrate the base geoengine demo module to Odoo 19.0 while correcting geospatial behavior and expanding automated coverage.

Bug Fixes:

  • Fix retail machine point and ZIP validation for multi-record operations and clear the computed ZIP when no point or matching area exists.

Enhancements:

  • Migrate the demo module to Odoo 19.0 and update its geospatial test environment.

Build:

  • Use a PostGIS-enabled PostgreSQL service for workflow tests and add the migrated geospatial module requirement.

Tests:

  • Add coverage for ZIP computation, sales aggregation, point/ZIP validation, multi-record constraints, and display names.

Chores:

  • Remove the obsolete migration work log and refresh translation catalogs for the updated validation message.

@weinni2000
weinni2000 force-pushed the 19.0-mig-base_geoengine_demo branch from 48c15b7 to b430ed6 Compare November 1, 2026 09:00
@sourcery-ai

sourcery-ai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Migrates base_geoengine_demo to Odoo 19.0, fixes its point/ZIP constraint for multi-record writes with updated translation formatting, adds regression tests for core geo and sales behavior, and pins the required in-progress base_geoengine migration dependency.

Sequence diagram for multi-record point and ZIP validation

sequenceDiagram
    participant ORM
    participant RetailMachine
    participant DummyZip
    participant Env
    participant ValidationError

    ORM->>RetailMachine: _check_the_point()
    loop each record
        alt the_point or zip_id missing
            RetailMachine-->>ORM: continue
        else both values present
            RetailMachine->>DummyZip: search([id, the_geom geo_contains the_point], limit=1)
            alt ZIP contains point
                RetailMachine-->>ORM: validation succeeds
            else ZIP does not contain point
                RetailMachine->>Env: _("The point must be placed in the corresponding area. (serial number: %(name)s).")
                RetailMachine->>ValidationError: raise message % {name: rec.name}
            end
        end
    end
Loading

File-Level Changes

Change Details Files
Migrates the demo module metadata and removes the obsolete migration work log.
  • Bumps the module version to 19.0.1.0.0.
  • Deletes the 18.0 upgrade notes.
  • Updates generated translation catalogs for the revised validation message.
base_geoengine_demo/UPGRADE.md
base_geoengine_demo/__manifest__.py
base_geoengine_demo/i18n/base_geoengine_demo.pot
base_geoengine_demo/i18n/es.po
base_geoengine_demo/i18n/it.po
base_geoengine_demo/i18n/zh_CN.po
Makes the point/ZIP constraint safe for multi-record operations and updates its translatable error formatting.
  • Iterates over each record and validates only records with both point and ZIP values.
  • Uses record-specific geometry values in the containment query.
  • Formats the named translation placeholder with the affected machine serial number.
base_geoengine_demo/models/retail_machine.py
Adds transactional coverage for the migrated retail-machine behavior.
  • Tests point-based ZIP computation and ZIP total-sales aggregation.
  • Tests invalid point/ZIP combinations and multi-record constraint writes.
  • Tests ZIP display names.
base_geoengine_demo/tests/__init__.py
base_geoengine_demo/tests/test_retail_machine.py
Adds the pending 19.0 geospatial dependency needed by the demo module.
  • Installs base_geoengine from the 19.0 migration branch or change under review.
test-requirements.txt

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_demo/models/retail_machine.py" line_range="37" />
<code_context>
-                        [
-                            ("id", "=", self.zip_id.id),
-                            ("the_geom", "geo_contains", rec.the_point),
-                        ],
-                        limit=1,
-                    )
</code_context>
<issue_to_address>
**Edited areas leave invalid assignments**

When a ZIP geometry is edited so it no longer contains a machine assigned to that ZIP, editing a ZIP polygon does not invoke `_check_the_point` on its retail machines, so machines whose points are no longer inside their assigned ZIP remain stored with invalid assignments; a concurrent polygon edit after this search can produce the same state.

Validate linked machines when ZIP geometry changes, and make that validation safe against concurrent geometry and machine updates.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and if the revised constraint is wrong, a machine could be saved with a point that does not belong to its selected ZIP area; those existing records would need to be corrected after a revert. The added test requirement also points to an external Git dependency.

Blocking findings: base_geoengine_demo/models/retail_machine.py:37


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

[
("id", "=", rec.zip_id.id),
("the_geom", "geo_contains", rec.the_point),
],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Edited areas leave invalid assignments

When a ZIP geometry is edited so it no longer contains a machine assigned to that ZIP, editing a ZIP polygon does not invoke _check_the_point on its retail machines, so machines whose points are no longer inside their assigned ZIP remain stored with invalid assignments; a concurrent polygon edit after this search can produce the same state.

Validate linked machines when ZIP geometry changes, and make that validation safe against concurrent geometry and machine updates.

Prompt for AI agents
In `base_geoengine_demo/models/retail_machine.py` at line 37:

**Edited areas leave invalid assignments**

When a ZIP geometry is edited so it no longer contains a machine assigned to that ZIP, editing a ZIP polygon does not invoke `_check_the_point` on its retail machines, so machines whose points are no longer inside their assigned ZIP remain stored with invalid assignments; a concurrent polygon edit after this search can produce the same state.

Validate linked machines when ZIP geometry changes, and make that validation safe against concurrent geometry and machine updates.

@weinni2000
weinni2000 force-pushed the 19.0-mig-base_geoengine_demo branch from 7e37637 to 48c15b7 Compare November 1, 2026 09:51
Assisted-by: Claude Code (claude-opus-5-5)
@weinni2000
weinni2000 force-pushed the 19.0-mig-base_geoengine_demo branch from b430ed6 to 85e6e2f Compare November 5, 2026 10:14
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