Skip to content

Commit 5476efd

Browse files
committed
Merge PR OCA#4987 into 16.0
Signed-off-by pedrobaeza
2 parents 5fd4800 + 6e8fdfd commit 5476efd

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

l10n_es_facturae/models/account_move.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def _get_facturae_move_attachments(self):
225225
description, content_type = attachment.filename.rsplit(".", 1)
226226
result.append(
227227
{
228-
"data": attachment.file,
228+
"data": attachment.file.decode("utf-8"),
229229
"content_type": content_type,
230230
"encoding": "BASE64",
231231
"description": description,

l10n_es_facturae/tests/common.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,11 @@ def test_facturae_with_extra_attachments(self):
340340
]
341341
}
342342
)
343+
# Ensure attachments data is correctly decoded on base64
344+
attachments = self.move._get_facturae_move_attachments()
345+
for attachment in attachments:
346+
self.assertFalse(isinstance(attachment["data"], bytes))
347+
self.assertTrue(isinstance(attachment["data"], str))
343348
generated_facturae = self._create_facturae_file(self.move, force=True)
344349
self.assertTrue(
345350
generated_facturae.xpath(

0 commit comments

Comments
 (0)