-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[16.0][FIX] l10n_nl_xaf_auditfile_export: parse EntityRef error #398
[16.0][FIX] l10n_nl_xaf_auditfile_export: parse EntityRef error #398
Conversation
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
I don't see a difference between before and after |
@thomaspaulb did you try with the steps to reproduce? |
@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" ? |
@thomaspaulb it means that returns a type "Markup" instead of "String". |
@@ -13,7 +13,8 @@ class IrQwebAuditfileStringWidget999(models.AbstractModel): | |||
@api.model | |||
def value_to_html(self, value, options): | |||
value = value[: self._max_length] if value else "" | |||
return super().value_to_html(value, options) | |||
res = super().value_to_html(value, options) | |||
return str(res) # From markup to string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some tests with the help of #399, and indeed I'm running into the xmlParseEntityRef: no name
error in cases where a field contains an ampersand.
However your fix only addresses cases where the widget is used. I found that changing xml.unescape()
to str(xml)
over here addresses the issue for all fields, regardless of the widget used (mine was here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your approach, I think is the correct way. Is it ok for you to fix it directly in your PR, so that we can close this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep both things separated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now done in #410
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested the change and it works now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll merge this as it already fixes part of the problem
/ocabot merge
Hi @hbrunn. Your command failed:
Ocabot commands
More information
|
/ocabot merge patch |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at c356ef4. Thanks a lot for contributing to OCA. ❤️ |
When an account has an "&" character in its name, the XAF auditfile export fails.
Here are 2 different errors I was able to reproduce:
b'xmlParseEntityRef: no name'
(probably the one described in line 1653: b'xmlParseEntityRef: no name' #397)b"EntityRef: expecting ';'"
Steps to reproduce:
l10n_nl
110000 Debiteuren
(that for sure is listed in the auditfile), for example name it: "Debiteuren & test"After some investigations, it seems that
value_to_html()
returns a markup instead of a string. This seems making theetree.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.