Repository navigation
[19.0][MIG] base_geoengine_demo: Migration to 19.0 - #9
weinni2000 wants to merge 1 commit into
Conversation
48c15b7 to
b430ed6
Compare
Reviewer's GuideMigrates 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 validationsequenceDiagram
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
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
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
| [ | ||
| ("id", "=", rec.zip_id.id), | ||
| ("the_geom", "geo_contains", rec.the_point), | ||
| ], |
There was a problem hiding this comment.
🟡 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.7e37637 to
48c15b7
Compare
Assisted-by: Claude Code (claude-opus-5-5)
b430ed6 to
85e6e2f
Compare
_check_the_point: loop over the records instead of readingself.the_point/self.zip_id(failed on multi-record writes), and useself.env._with a named placeholder (msgid updated in the existing translations)._compute_zip_id: clearzip_idwithFalseinstead of0, which gave the nonexistent recorddummy.zip(0,)when the point was removed.test-requirements.txt: installbase_geoenginefrom the 19.0 migration [19.0][MIG] base_geoengine: consolidated migration OCA/geospatial#465, which is not merged yet.UPGRADE.mdwork 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:
Enhancements:
Build:
Tests:
Chores: