[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 <jco@odoo.com>
Signed-off-by: Mehdi Bendali Hacine (mebe) <mebe@odoo.com>
This commit is contained in:
Mehdi Bendali Hacine
2023-07-15 10:54:20 +02:00
parent a0940e4db0
commit b7a72872bf
+1 -1
View File
@@ -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