Skip to content

[BUG][18.0] report_csv: _render_csv fails when docids is None #1125

@LoayMoh99

Description

@LoayMoh99

Module

report_csv

Describe the bug

Rendering a CSV report fails with a TypeError when docids is None.
The _render_csv method assumes docids is always iterable and calls len(docids) without checking its value.

To Reproduce

Affected versions:

Steps to reproduce the behavior:

  1. Trigger a CSV report rendering without passing docids
  2. _render_csv is called with docids=None
  3. The method executes len(docids)
  4. A TypeError is raised

Expected behavior
CSV reports should render correctly even when docids is None, consistent with other Odoo report renderers.

Actual behavior
A TypeError is raised and the report rendering fails.

Additional context
Error:

TypeError: object of type 'NoneType' has no len()

Code reference:

res_id = len(docids) == 1 and docids[0]


Environment:
OS: Linux
Python: 3.x
Odoo: 18.0

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