Skip to content

[18.0] OpenLayers assets not loaded in standard mode (Odoo 18) → ol is not defined #412

@yterrettaz

Description

@yterrettaz

Description:

In Odoo 18, the OpenLayers JS/CSS have been moved into assets (see base_geoengine/manifest.py
).

When creating a custom module in standard mode, these assets are not loaded, and we get the following error in the browser console:
Uncaught (in promise) ReferenceError: ol is not defined

This happens because the OpenLayers bundle is not part of the custom module’s assets by default.
However, if we run the instance with ?debug=assets, everything works fine, since all files are included individually.

We can see the same error during the migration of the demo module (cf. PR #406
).

Expected behavior:

OpenLayers should be available automatically to any module that depends on base_geoengine, as in previous versions.

Possible solutions:

Include the OpenLayers bundle in web.assets_backend directly in base_geoengine, so all dependent modules get it. Or provide clear documentation/example on how to properly include the OpenLayers bundle in custom modules.

Environment:

Odoo version: 18.0
Module: base_geoengine
Browser console shows: ol is not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions