Don't return a traceback if the password is wrong. (#7)

Instead return a UserError.
Locales

Task #160407
This commit is contained in:
Juanjo Garcia Pagan 2023-07-19 11:25:41 +02:00 committed by Juanjo Garcia
parent 9b9fe4ee67
commit f100e5a156
4 changed files with 23 additions and 1 deletions

View file

@ -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)

View file

@ -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 ""

View file

@ -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"

View file

@ -61,5 +61,8 @@ Message returned by signing process: %(process_output)s</field>
<record model="ir.message" id="msg_draft_invoice_facturae_sent">
<field name="text">Can not draft "%(invoices)s" that have been sent to Factura-e.</field>
</record>
<record model="ir.message" id="msg_certificate_error">
<field name="text">Error while getting the certificate: "%(error)s".</field>
</record>
</data>
</tryton>