From f100e5a156cfd39f62f7a1a0f29a409533d326f2 Mon Sep 17 00:00:00 2001 From: Juanjo Garcia Pagan <57089222+juanjo-nan@users.noreply.github.com> Date: Wed, 19 Jul 2023 11:25:41 +0200 Subject: [PATCH] Don't return a traceback if the password is wrong. (#7) Instead return a UserError. Locales Task #160407 --- invoice.py | 4 +++- locale/ca.po | 4 ++++ locale/es.po | 13 +++++++++++++ message.xml | 3 +++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/invoice.py b/invoice.py index 8620b1d..c991727 100644 --- a/invoice.py +++ b/invoice.py @@ -502,7 +502,9 @@ class Invoice(metaclass=PoolMeta): except ValueError as e: logger.warning("Error load_key_and_certificates file", exc_info=True) - raise UserError(str(e)) + raise UserError(gettext( + 'account_invoice_facturae.msg_certificate_error', + error=str(e))) # DER is an ASN.1 encoding type crt = certificate.public_bytes(serialization.Encoding.DER) diff --git a/locale/ca.po b/locale/ca.po index 1142d6e..8423479 100644 --- a/locale/ca.po +++ b/locale/ca.po @@ -195,6 +195,10 @@ msgid "Missing Password Factura-e Certificate in company \"%(company)s\"." msgstr "" "Falta la contrasenya del certificat Factura-e a l'empresa \"%(company)s\"." +msgctxt "model:ir.message,text:msg_certificate_error" +msgid "Error while getting the certificate: \"%(error)s\"." +msgstr "S'ha produït un error mentre s'obtenia el certificat: \"%(error)s\"." + msgctxt "model:ir.message,text:no_rate" msgid "No rate found for currency \"%(currency)s\" on \"%(date)s\"" msgstr "" diff --git a/locale/es.po b/locale/es.po index 2d776c1..29f743b 100644 --- a/locale/es.po +++ b/locale/es.po @@ -200,6 +200,11 @@ msgstr "" "Falta la contraseña del certificado Factura-e Certificate en la empresa " "\"%(company)s\"." +msgctxt "model:ir.message,text:msg_certificate_error" +msgid "Error while getting the certificate: \"%(error)s\"." +msgstr "" +"Se ha producido un error mientras se obtenía el certificado: \"%(error)s\"." + msgctxt "model:ir.message,text:no_rate" msgid "No rate found for currency \"%(currency)s\" on \"%(date)s\"" msgstr "" @@ -780,6 +785,14 @@ msgctxt "view:account.invoice:" msgid "Generate Factura-e" msgstr "Generar Factura-e" +msgctxt "view:account.tax.template:" +msgid "Factura-e" +msgstr "Factura-e" + +msgctxt "view:account.tax:" +msgid "Factura-e" +msgstr "Factura-e" + msgctxt "view:party.party:" msgid "Factura-e" msgstr "Factura-e" diff --git a/message.xml b/message.xml index 5222b29..bb320de 100644 --- a/message.xml +++ b/message.xml @@ -61,5 +61,8 @@ Message returned by signing process: %(process_output)s Can not draft "%(invoices)s" that have been sent to Factura-e. + + Error while getting the certificate: "%(error)s". +