Skip to content
Closed
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
2 changes: 1 addition & 1 deletion web_view_leaflet_map/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Leaflet Map View (OpenStreetMap)",
"summary": "Add new 'leaflet_map' view, to display markers.",
"version": "18.0.1.1.2",
"version": "18.0.1.1.3",
"author": "GRAP, Odoo Community Association (OCA)",
"maintainers": ["legalsylvain"],
"website": "https://github.com/OCA/geospatial",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {useService} from "@web/core/utils/hooks";

/* global L, console, document */

const {Component, onWillStart, onMounted, onPatched, useRef} = owl;
const {Component, onWillStart, onMounted, onPatched, onWillUpdateProps, useRef} = owl;

export class MapRenderer extends Component {
static template = "web_view_leaflet_map.MapRenderer";
Expand Down Expand Up @@ -58,24 +58,30 @@ export class MapRenderer extends Component {
this.renderMarkers();
}
});

// Reload the records when the search domain/context changes (filters,
// favorites, ...) so the markers reflect the active search.
onWillUpdateProps(async (nextProps) => {
await this.loadRecords(nextProps.domain, nextProps.context);
});
}

/**
* Loads records from the server based on the provided domain and fields.
* @returns {Promise<void>}
*/
async loadRecords() {
async loadRecords(domain, context) {
const fields = this.getFields();

try {
// Cargar registros usando searchRead
const records = await this.orm.searchRead(
this.resModel,
this.props.domain || [],
domain === undefined ? this.props.domain || [] : domain,
fields,
{
limit: this.props.limit || 80,
context: this.props.context || {},
context: context === undefined ? this.props.context || {} : context,
}
);
this.records = records;
Expand Down
Loading