Skip to content

[18.0][report_xlsx] XLRDError: Excel xlsx file; not supported - test_report fails with xlrd 2.0+ #1106

@sn-alf

Description

@sn-alf

Summary

The test_report test fails because xlrd 2.0+ dropped support for .xlsx files. The test uses xlrd.open_workbook() to verify generated xlsx output, but xlrd 2.0+ only supports legacy .xls (BIFF) format.

Affected versions

  • Odoo: 18.0
  • OCA repository: OCA/reporting-engine / branch: 18.0
  • Module(s): report_xlsx version 18.0.1.1.2

Environment

  • Deployment: Odoo.sh
  • OS: Linux (Odoo.sh container)
  • Python: 3.x (system default)
  • PostgreSQL: 14+
  • xlrd: 2.0+ (system package /usr/lib/python3/dist-packages/xlrd/)

Steps to reproduce

  1. Install report_xlsx module on Odoo 18.0
  2. Run tests: -i report_xlsx --test-enable
  3. Observe test_report fails

Expected behavior

All tests pass. The generated xlsx file content is verified successfully.

Actual behavior

test_report raises XLRDError because xlrd 2.0+ cannot read xlsx files.

Error / Traceback / Logs

2025-12-17 17:09:31,943 22 INFO ... odoo.addons.report_xlsx.tests.test_report: Starting TestReport.test_report ...
2025-12-17 17:09:31,953 22 ERROR ... odoo.addons.report_xlsx.tests.test_report: ERROR: TestReport.test_report
Traceback (most recent call last):
  File "/home/odoo/src/user/report_xlsx/tests/test_report.py", line 31, in test_report
    wb = open_workbook(file_contents=rep[0])
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/xlrd/__init__.py", line 170, in open_workbook
    raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
xlrd.biffh.XLRDError: Excel xlsx file; not supported

2025-12-17 17:09:32,002 22 ERROR ... odoo.modules.loading: Module report_xlsx: 0 failures, 1 errors of 4 tests

Additional context

  • Frequency: Always (100% reproducible on systems with xlrd ≥2.0)
  • Root cause: xlrd 2.0.0 (Dec 2020) dropped xlsx support. From xlrd changelog: "xlrd 2.0+ only supports .xls files. For xlsx, use openpyxl."
  • Module functionality is NOT affected — only the test verification is broken. The xlsx generation via xlsxwriter works correctly.
  • Suggested fix: Replace xlrd with openpyxl in test dependencies:

References

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