Skip to content

Commit

Permalink
Merge PR #410 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by NL66278
  • Loading branch information
OCA-git-bot committed Apr 8, 2024
2 parents 2fb9138 + b219090 commit 5f1edf3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 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 @@ -144,6 +144,7 @@ def test_04_export_success_unit4(self):
self.assertTrue(record.name)
self.assertTrue(record.auditfile)
self.assertTrue(record.auditfile_name)
self.assertTrue(record.auditfile_success)
self.assertTrue(record.company_id)
self.assertTrue(record.date_start)
self.assertTrue(record.date_end)
Expand All @@ -163,13 +164,13 @@ def test_05_export_success(self):
record = self.env["xaf.auditfile.export"].create({})
record.name += "%s01" % os.sep
record.button_generate()
self.assertTrue(record)
self.assertTrue(record.auditfile_success)

def test_06_include_moves_from_inactive_journals(self):
"""Include moves off of inactive journals"""
record = self.env["xaf.auditfile.export"].create({})
record.button_generate()
self.assertTrue(record)
self.assertTrue(record.auditfile_success)

line_count = record.get_move_line_count()
parsed_line_count = get_transaction_line_count_from_xml(record.auditfile)
Expand All @@ -182,7 +183,7 @@ def test_06_include_moves_from_inactive_journals(self):

record_after = self.env["xaf.auditfile.export"].create({})
record_after.button_generate()
self.assertTrue(record_after)
self.assertTrue(record_after.auditfile_success)

line_count_after = record_after.get_move_line_count()
parsed_count_after = get_transaction_line_count_from_xml(record_after.auditfile)
Expand All @@ -206,7 +207,7 @@ def test_07_do_not_include_section_and_note_move_lines(self):
)
record = self.env["xaf.auditfile.export"].create({})
record.button_generate()
self.assertTrue(record)
self.assertTrue(record.auditfile_success)

line_count = record.get_move_line_count()
parsed_line_count = get_transaction_line_count_from_xml(record.auditfile)
Expand Down Expand Up @@ -321,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 5f1edf3

Please sign in to comment.