Skip to content

[18.0] account_financial_report: Journal Ledger HTML report broken (staircase layout) when account.tax description contains HTML #1545

Description

@josecrea

Module

account_financial_report 18.0.1.4.20 (Odoo 18.0)

Describe the bug

The Journal Ledger HTML report renders completely broken — every move nests inside the previous one, producing a diagonal "staircase" layout — when any account.tax has a description that contains HTML.

In Odoo 18 account.tax.description is an Html field. As soon as a user edits it through the web editor, its value becomes e.g.:

<div data-oe-version="1.1">IGIC 7%</div>

Root cause

In report/templates/journal_ledger.xml, the taxes cell of report_journal_move_line does:

<span t-esc="limit_text(o._get_ml_tax_description(move_line, tax_line_dat, move_line_ids_taxes_dat), 'label_text_limit')" />

Two things combine:

  1. The Html field value is a Markup object, so t-esc does not escape it — the raw HTML is injected into the report.
  2. limit_text truncates it by slicing, cutting off the closing </div> mid-tag.

Result: one unclosed <div> is emitted per tax line. In HTML parsing every subsequent element nests inside it, so the whole report collapses into a staircase (in our real-world ledger: 111 unclosed divs). The PDF variant is affected by the same raw-HTML injection.

Steps to reproduce

  1. On any account.tax, edit Description displayed on invoices via the backend form (the web editor wraps the text: <div data-oe-version="1.1">…</div>).
  2. Post an invoice using that tax.
  3. Run Journal Ledger over a period containing that move and open the HTML output.

Expected behavior

The taxes column should show plain text. Suggested fix: strip HTML before truncating, e.g. html2plaintext() inside _get_ml_tax_description() (or make limit_text coerce Markup to plain str and escape).

Additional observations

  • QWeb logs Unknown directives or unused attributes: {'t-eval'} in account_financial_report.report_journal_move — lines <t t-set="last_partner" t-eval="None"/> / <t t-set="display_partner" t-eval="True"/> use the removed t-eval directive, so those t-set are no-ops in 18.0.
  • Unrelated but worth noting: the es_ES translation of report_journal_ledger_journal_table_header translates the literal style terms (width: 8.11%;ancho: 8.11%;), so two columns lose their width in Spanish. Probably a Weblate artifact.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions