[FIX] l10n_sa_edi: fix wrong edi content returned
The `_l10n_sa_get_invoice_content_edi` function is used to download the edi_content of an edi_document when this edi_document is in error. This function should return the xml encoded as a bytes, as it is then encoded in base64 in account_edi/models/account_edi_document.py otherwise a closes odoo/odoo#131837 Typeerror: "a bytes-like object is required, not 'dict'" is raised. X-original-commit: 8bf1d6e0abdd41211045d23a512be5269a7d1b0c Signed-off-by: Josse Colpaert <jco@odoo.com> Signed-off-by: Julien Van Roy (juvr) <juvr@odoo.com>
This commit is contained in:
@@ -455,9 +455,7 @@ class AccountEdiFormat(models.Model):
|
||||
Return contents of the submitted UBL file or generate it if the invoice has not been submitted yet
|
||||
"""
|
||||
doc = invoice.edi_document_ids.filtered(lambda d: d.edi_format_id.code == 'sa_zatca' and d.state == 'sent')
|
||||
if doc is not None and doc.attachment_id.datas:
|
||||
return {invoice: {'xml_file': doc.attachment_id.datas.decode()}}
|
||||
return {invoice: {'xml_file': self._l10n_sa_generate_zatca_template(invoice)}}
|
||||
return doc.attachment_id.raw or self._l10n_sa_generate_zatca_template(invoice).encode()
|
||||
|
||||
def _get_move_applicability(self, move):
|
||||
# EXTENDS account_edi
|
||||
|
||||
Reference in New Issue
Block a user