Repository navigation
Conversation
Assisted-by: Claude Code (claude-opus-5-5)
…tor API Register the spatial operators with `operator_optimization` and convert them to `Domain.custom` at full optimization, replacing the monkey patches of `DomainCondition._optimize_step`, `DomainCondition._to_sql` and `Field._condition_to_sql`. Odoo then resolves relational paths, inherited and searchable fields before the spatial SQL is generated. Direct geometry comparisons now carry the SRID of the field, which fixes `geo_equal` returning no match for an identical geometry. Invalid indirect references (empty, unknown model or field, non-string key) raise a `ValueError`. Read access on the related model and on the referenced fields is still checked, together with `_access_domain`. Add six regression tests: direct equality and SRID, invalid references, spatial operator on a non-geo field, relational path, archived records and `Domain` sub-domains, and indirect search without read access. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The core domain field reports the python dict of an indirect geo
condition ({"<model>.<geo field>": <domain>}) as a non-literal, so the
vector layer form showed "Invalid domain" for a valid domain. Evaluate
such domains directly for geoengine.vector.layer.
A colored or proportional layer without any value (e.g. its domain
matches no record) made geostats throw "You should first enter a
serie!", which aborted the rendering of all the layers. Such a layer now
gets the default style.
Also remove a leftover console.log in the colored layer style.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Reviewer's GuideAPIRegister spatial operators through Odoo’s optimization API and compile them into custom domains at full optimization.
ImplementationImplement spatial SQL generation with field-SRID geometry comparisons, validated indirect references, and related-model access and record-rule checks.
UIEvaluate valid indirect spatial domains in the vector-layer editor and fall back to default styling when colored or proportional layers have no usable values.
TestsAdd regression coverage and fixture fields for spatial equality and SRID, invalid operators and references, relational paths, active filtering, and related-model access.
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/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.esm.js" line_range="1123" />
<code_context>
+ // instead of aborting the rendering of all the layers.
+ if (
+ ["colored", "proportion"].includes(cfg.geo_repr) &&
+ !this.extractLayerValues(cfg, data).length
+ ) {
+ return this.styleVectorLayerDefault(cfg);
</code_context>
<issue_to_address>
**Empty values still reach classification**
When matching records exist but all have an unset attribute value, when matching records exist but their attribute values are all unset, `extractLayerValues` returns an array with entries, so this guard does not select the default style and the colored or proportional classifiers still receive values with no usable data; the layer can still render incorrectly or fail.
Filter out unset values before classification and select the default style when no usable values remain.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and indirect spatial searches build an EXISTS query over a related model, so a mistake in the compiled read-access domain could let users infer matches involving records they cannot read. That inference cannot be undone by reverting, though the change does not appear to establish a new access policy or trust boundary.
Blocking findings: base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.esm.js:1123
Also fall back to the default style when records exist but the attribute of a colored or proportional layer is unset on all of them, not only when no record matches. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
44a8119 to
f54f4f9
Compare
Proposed on top of OCA#489 (head
8e99ffa):DomainCondition/Fieldwithoperator_optimization+Domain.custom. Relational paths are resolved by core; access checks are kept.geo_equalreturning nothing for identical geometries (the SRID was missing); invalid indirect references now raiseValueError.Tested on Odoo 20 / PostgreSQL 17 / PostGIS, and in the browser (domain editor, map). Upstream CI still to run.
🤖 Generated with Claude Code
Summary by Sourcery
Modernize spatial domain handling and stabilize geoengine domain evaluation and map rendering.
Bug Fixes:
Enhancements:
Tests: