Skip to content

[BUG][18.0] base_geoengine: Records Panel search throws TypeError on missing display_name #461

@solomonprabu

Description

@solomonprabu

[base_geoengine] TypeError when searching in records panel

Module

base_geoengine

Describe the bug

When attempting to filter records using the search bar within the Geoengine records panel, a JavaScript TypeError: Cannot read properties of undefined (reading 'toLowerCase') is thrown, resulting in an Odoo Client Error popup.

This occurs in records_panel.esm.js within the filterItems method because the code assumes item.data.display_name (or item.data.name in earlier revisions) will always be a populated string. If a record lacks a display name, it evaluates to undefined or false, causing the .toLowerCase() call to fail and breaking the filter functionality.

To Reproduce

Affected versions:
18.0

Steps to reproduce the behavior:

  1. Install geoengine_partner from here [18.0] [MIG] geoengine_partner #460 , as the module includes the view where the error occurs.
  2. Navigate to a contacts module containing a Geoengine view (e.g., Contacts map view).
  3. Click on the geoengine view (with the 🌏 logo)
  4. Start typing in the "CONTACT" search bar located on the right panel to filter the records.
  5. An "Oops!" Odoo Client Error modal appears displaying the TypeError.
    Expected behavior
    The search bar should safely filter the displayed list of records without throwing an exception, gracefully handling cases where a record's display name might be undefined or empty.

Additional context
The problematic code block in base_geoengine/static/src/js/views/geoengine/records_panel/records_panel.esm.js:

filterItems(value, items) {
const lowerValue = value.toLowerCase();
return items.filter(
(item) => item.data.display_name.toLowerCase().indexOf(lowerValue) >= 0
);
}

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions