Skip to content

Commit

Permalink
[FIX] Improved fix for OCA#398
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspaulb committed Apr 8, 2024
1 parent be02bb0 commit b219090
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 1 addition & 2 deletions l10n_nl_xaf_auditfile_export/models/ir_qweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class IrQwebAuditfileStringWidget999(models.AbstractModel):
@api.model
def value_to_html(self, value, options):
value = value[: self._max_length] if value else ""
res = super().value_to_html(value, options)
return str(res) # From markup to string
return super().value_to_html(value, options)


class IrQwebAuditfileStringWidget9(models.AbstractModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def button_generate(self):
)
# convert to string and prepend XML encoding declaration
xml = (
xml.unescape()
str(xml)
.strip()
.replace(
"<auditfile ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,15 @@ def xaf_val(auditfile, xpath):
record.auditfile, "//a:openingBalance/a:linesCount/text()"
)
self.assertEqual(lines_count, 2)

def test_10_ampersand_in_name(self):
"""Error because of invalid characters in an auditfile"""
record = (
self.env["xaf.auditfile.export"]
.with_context(dont_sanitize_xml=True)
.create({})
)
# add an ampersand
record.company_id.name += " & OCA"
record.button_generate()
self.assertTrue(record.auditfile_success)

0 comments on commit b219090

Please sign in to comment.