[FIX] l10n_sa_edi: fix access to attachment of EDI document
Steps to reproduce: - Install Accounting and l10n_sa_edi - Connect with a non-admin user (e.g. Marc Demo) - Switch to a SA company - Create an invoice - Click on "SEND & PRINT" => A traceback is raised when trying to access the attachment linked to the ZATCA document. Cause: Since this commit https://github.com/odoo/odoo/commit/44a4cdb3944a4b722dcfbca5e2947a4372b8501d the attachment of an EDI document is restricted to users with "Administration: Settings" rights. opw-3663305 closes odoo/odoo#149055 X-original-commit: 2fa9626f45b8c0c890d0771d731c4a13c5a7a9d1 Signed-off-by: Olivier Colson (oco) <oco@odoo.com> Signed-off-by: Anh Thao Pham (pta) <pta@odoo.com>
This commit is contained in:
@@ -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, True)
|
||||
qr_code_str = b64encode(qr_code_str).decode()
|
||||
elif zatca_document.state == 'sent' and zatca_document.attachment_id.datas:
|
||||
elif zatca_document.state == 'sent' and zatca_document.sudo().attachment_id.datas:
|
||||
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]
|
||||
|
||||
Reference in New Issue
Block a user