Skip to content

[18.0][FIX] account_financial_report: plain text tax descriptions in journal ledger - #1592

Open
parabol123654 wants to merge 1 commit into
OCA:18.0from
parabol123654:18.0-fix-account_financial_report-tax-description-html
Open

parabol123654 wants to merge 1 commit into
OCA:18.0from
parabol123654:18.0-fix-account_financial_report-tax-description-html

Conversation

@parabol123654

@parabol123654 parabol123654 commented Oct 28, 2026 •

Copy link
Copy Markdown

Fixes #1545.

Problem: in 18.0 account.tax.description is an Html field. Once it is edited in the web editor it holds e.g. <div data-oe-version="1.1">IGIC 7%</div>. The Journal Ledger shows it in the Taxes column of tax lines through limit_text(...): the value is Markup, so t-esc does not escape it, and label_text_limit (40 by default) cuts it in the middle, leaving a <div> open for every tax line. Each following move is then nested in the previous one (the "staircase" layout from the issue). The XLSX export shows the raw HTML in the same column.

Fix: _get_ml_tax_description converts the description to plain text with html2plaintext, and falls back on the tax name when the description is empty (an emptied editor leaves <p><br></p>, which is truthy).

Test: test_04_tax_description_html gives the purchase tax an editor-style description, posts a bill, and checks the description the wizard returns for the tax line: plain text, and the tax name when the description is an emptied editor (<p><br></p>). Without the fix it fails (the wizard returns the Markup); with the fix it passes, along with the rest of the module's tests (28 tests on Odoo 18.0).

The t-eval warning in the same template is fixed separately in #1593.

The per-journal tax summary table also prints the description, but uncut, so it does not break the layout; this PR leaves it as is. The same code is in 19.0; I can forward-port once this is merged.

(#1567 proposed a similar change but was closed by its author without review. #1418 touches the per-line taxes data next to this code; the two changes do not conflict.)

Assisted-by: Claude Opus 5.5

@OCA-git-bot OCA-git-bot added mod:account_financial_report Module account_financial_report series:18.0 labels Oct 28, 2026
@pedrobaeza pedrobaeza added this to the 18.0 milestone Oct 28, 2026

@pedrobaeza pedrobaeza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you reuse an existing test instead of doing a new one? If we keep creating new test cases, the code for tests will be unmaintainable and very slow for each build.

@oca-cla-bot

oca-cla-bot Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@pedrobaeza

Copy link
Copy Markdown
Member

Please don't join several patches in the same PR, and also sign the CLA.

@parabol123654

Copy link
Copy Markdown
Author

Thanks, done: this PR now only has the tax description fix (one commit), and the t-eval fix is in its own PR, #1593. The CLA is signed too.

…l ledger

account.tax.description is an Html field in 18.0: once edited in the
web editor it holds e.g. <div data-oe-version="1.1">IGIC 7%</div>.
The journal ledger printed it as Markup in the Taxes column after
label_text_limit cut it, leaving a <div> open for every tax line, so
each following move was nested in the previous one ("staircase").

Convert the description to plain text, falling back on the tax name.

Fixes OCA#1545

Assisted-by: Claude Opus 5.5
@parabol123654
parabol123654 force-pushed the 18.0-fix-account_financial_report-tax-description-html branch from f215ff6 to 3ec258c Compare November 14, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:account_financial_report Module account_financial_report series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants