Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,10 @@ export class GeoengineRenderer extends Component {
this.styleVectorLayerAndLegend(vector, data, layer);
this.useRelatedModel(vector, layer, data);
} else {
const data = this.props.data.records;
// Filter records with coordinates for styling vector layers & legends
const data = this.props.data.records.filter(
(record) => record.data[vector.geo_field_id[1]] !== false
);
this.styleVectorLayerAndLegend(vector, data, layer);
this.addSourceToLayer(data, vector, layer);
}
Expand Down Expand Up @@ -817,7 +820,10 @@ export class GeoengineRenderer extends Component {
this.styleVectorLayerAndLegend(cfg, data, lv);
this.useRelatedModel(cfg, lv, data);
} else {
const data = this.props.data.records;
const geo_field_id_name = cfg.geo_field_id[1];
const data = this.props.data.records.filter(
(record) => record.data[geo_field_id_name] !== false
);
if (!data.length) {
return new ol.layer.Vector({
source: new ol.source.Vector(),
Expand All @@ -844,10 +850,13 @@ export class GeoengineRenderer extends Component {

async getModelData(cfg, fields_to_read) {
const domain = this.evalModelDomain(cfg);
const geo_field_id_name = cfg.geo_field_id[1];
let data = await this.orm.searchRead(cfg.model, [domain][0], fields_to_read);
const modelsRecords = this.models.find((e) => e.model.resModel === cfg.model)
.model.records;
data = data.map((data) => modelsRecords.find((rec) => rec.resId === data.id));
data = data
.map((data) => modelsRecords.find((rec) => rec.resId === data.id))
.filter((rec) => rec.data[geo_field_id_name] !== false);
return data;
}

Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
odoo-test-helper
odoo-addon-base_geoengine @ git+https://github.com/OCA/geospatial.git@refs/pull/454/head#subdirectory=setup/base_geoengine
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

chore: please specify in the main message that this PR depends on #454

Usually this line is added in a separate commit so it can be easily removed later once #454 is merged.

Loading