diff --git a/addons/l10n_sa_edi/models/account_edi_format.py b/addons/l10n_sa_edi/models/account_edi_format.py index 4b666e016a3..4209413c56b 100644 --- a/addons/l10n_sa_edi/models/account_edi_format.py +++ b/addons/l10n_sa_edi/models/account_edi_format.py @@ -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