OCA / l10n-netherlands

Odoo Dutch Localization
GNU Affero General Public License v3.0
21 stars 55 forks source link

[16.0][FIX] l10n_nl_xaf_auditfile_export: parse EntityRef error #398

Closed astirpe closed 7 months ago

astirpe commented 1 year ago

When an account has an "&" character in its name, the XAF auditfile export fails.

Here are 2 different errors I was able to reproduce:

Steps to reproduce:

After some investigations, it seems that value_to_html() returns a markup instead of a string. This seems making the etree.XMLParser() unhappy in case of any "&" character present. Converting the markup to string solves the issue. Not sure if there's a better way to solve it.

thomaspaulb commented 1 year ago

What do you mean by 'returns a markup' ?

If I look at what I think is the super function of the one you're modifying (I'm not 100% sure because there are several in ir_qweb_fields.py), and I naively run the code in Odoo shell, then I get this:

>>> from odoo.tools import pycompat, html_escape
>>> html_escape(pycompat.to_text('a & b'))
'a & b'
>>> str(html_escape(pycompat.to_text('a & b')))
'a & b'

I don't see a difference between before and after str() - both results are strings.

astirpe commented 1 year ago

@thomaspaulb did you try with the steps to reproduce?

thomaspaulb commented 1 year ago

@astirpe Not yet, but I believe you that I can reproduce it functionally that way. Before I go into the trouble of replicating the setup and setting a breakpoint to get the answer to my question, I'd ask you first. So, what do you mean by "returns a markup" ?

astirpe commented 1 year ago

@thomaspaulb it means that returns a type "Markup" instead of "String".

OCA-git-bot commented 7 months ago

Hi @hbrunn. Your command failed:

Required option bumpversion_mode for command merge. Possible values : major, minor, patch, nobump.

Ocabot commands

More information

hbrunn commented 7 months ago

/ocabot merge patch

OCA-git-bot commented 7 months ago

What a great day to merge this nice PR. Let's do it! Prepared branch 16.0-ocabot-merge-pr-398-by-hbrunn-bump-patch, awaiting test results.

OCA-git-bot commented 7 months ago

Congratulations, your PR was merged at c356ef49ffccb4909f02d57847baa1e8972942ed. Thanks a lot for contributing to OCA. ❤️