From b7a72872bf69e9b459cd3f55ba5fda4e6a8769d1 Mon Sep 17 00:00:00 2001 From: Mehdi Bendali Hacine Date: Tue, 11 Jul 2023 10:12:12 +0000 Subject: [PATCH] [FIX] l10n_sa_edi: Fix QR code extraction from XML content QR code extraction fails in some cases when we try to get the Base64 content from the Saudi EDI attachment when the datas is too voluminous. To avoid this, we pass bin_size=False in the context to always get the attachment datas correctly. closes odoo/odoo#128429 X-original-commit: c0369d9f5bda428e7501a7ab1e11134af8c7888d Signed-off-by: Josse Colpaert Signed-off-by: Mehdi Bendali Hacine (mebe) --- addons/l10n_sa_edi/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_sa_edi/models/account_move.py b/addons/l10n_sa_edi/models/account_move.py index 45455adf8df..b146b4cfc14 100644 --- a/addons/l10n_sa_edi/models/account_move.py +++ b/addons/l10n_sa_edi/models/account_move.py @@ -47,7 +47,7 @@ class AccountMove(models.Model): qr_code_str = move._l10n_sa_get_qr_code(move.journal_id, xml_content, b64decode(x509_cert), move.l10n_sa_invoice_signature, move._l10n_sa_is_simplified()) move.l10n_sa_qr_code_str = b64encode(qr_code_str).decode() elif zatca_document.state == 'sent' and zatca_document.attachment_id.datas: - document_xml = zatca_document.attachment_id.datas.decode() + document_xml = zatca_document.attachment_id.with_context(bin_size=False).datas.decode() root = etree.fromstring(b64decode(document_xml)) qr_node = root.xpath('//*[local-name()="ID"][text()="QR"]/following-sibling::*/*')[0] move.l10n_sa_qr_code_str = qr_node.text