diff --git a/account_ebics/__manifest__.py b/account_ebics/__manifest__.py
index a146884..fedda9f 100644
--- a/account_ebics/__manifest__.py
+++ b/account_ebics/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "EBICS banking protocol",
- "version": "16.0.1.0.0",
+ "version": "16.0.1.1.0",
"license": "LGPL-3",
"author": "Noviat",
"website": "https://www.noviat.com",
diff --git a/account_ebics/models/ebics_userid.py b/account_ebics/models/ebics_userid.py
index 9d541e5..08a8e04 100644
--- a/account_ebics/models/ebics_userid.py
+++ b/account_ebics/models/ebics_userid.py
@@ -87,6 +87,16 @@ class EbicsUserID(models.Model):
ebics_keys_fn = fields.Char(compute="_compute_ebics_keys_fn")
ebics_keys_found = fields.Boolean(compute="_compute_ebics_keys_found")
ebics_passphrase = fields.Char(string="EBICS Passphrase")
+ ebics_passphrase_store = fields.Boolean(
+ string="Store EBICS Passphrase",
+ default=True,
+ help="When you uncheck this option the passphrase to unlock "
+ "your private key will not be stored in the database. "
+ "We recommend to use this if you want to upload signed "
+ "payment orders via EBICS.\nYou will be prompted to enter the "
+ "passphrase for every EBICS transaction, hence do not uncheck this "
+ "option on a userid for automated EBICS downloads.",
+ )
ebics_ini_letter = fields.Binary(
string="EBICS INI Letter",
readonly=True,
@@ -195,7 +205,7 @@ class EbicsUserID(models.Model):
@api.constrains("ebics_passphrase")
def _check_ebics_passphrase(self):
for rec in self:
- if not rec.ebics_passphrase or len(rec.ebics_passphrase) < 8:
+ if rec.ebics_passphrase and len(rec.ebics_passphrase) < 8:
raise UserError(_("The passphrase must be at least 8 characters long"))
@api.onchange("ebics_version")
@@ -208,6 +218,11 @@ class EbicsUserID(models.Model):
if self.signature_class == "T":
self.swift_3skey = False
+ @api.onchange("ebics_passphrase_store")
+ def _onchange_ebics_passphrase_store(self):
+ if not self.ebics_passphrase_store:
+ self.ebics_passphrase = False
+
@api.onchange("swift_3skey")
def _onchange_swift_3skey(self):
if self.swift_3skey:
diff --git a/account_ebics/views/ebics_userid_views.xml b/account_ebics/views/ebics_userid_views.xml
index 11bb02e..d2da395 100644
--- a/account_ebics/views/ebics_userid_views.xml
+++ b/account_ebics/views/ebics_userid_views.xml
@@ -93,6 +93,16 @@
password="True"
attrs="{'required': [('state', '=', 'draft')]}"
/>
+
+
+
+
+
+
-
-
-
-
-
diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py
index 506ec48..55bc2fc 100644
--- a/account_ebics/wizards/ebics_xfer.py
+++ b/account_ebics/wizards/ebics_xfer.py
@@ -62,6 +62,9 @@ class EbicsXfer(models.TransientModel):
comodel_name="ebics.userid", string="EBICS UserID"
)
ebics_passphrase = fields.Char(string="EBICS Passphrase")
+ ebics_passphrase_stored = fields.Char(
+ string="EBICS Stored Passphrase", related="ebics_userid_id.ebics_passphrase"
+ )
date_from = fields.Date()
date_to = fields.Date()
upload_data = fields.Binary(string="File to Upload")
@@ -108,7 +111,7 @@ class EbicsXfer(models.TransientModel):
@api.onchange("ebics_config_id")
def _onchange_ebics_config_id(self):
ebics_userids = self.ebics_config_id.ebics_userid_ids
- if self._context.get("ebics_download"):
+ if self.env.context.get("ebics_download"):
download_formats = self.ebics_config_id.ebics_file_format_ids.filtered(
lambda r: r.type == "down"
)
@@ -425,9 +428,15 @@ class EbicsXfer(models.TransientModel):
def _setup_client(self):
self.ebics_config_id._check_ebics_keys()
passphrase = self._get_passphrase()
- keyring = EbicsKeyRing(
- keys=self.ebics_userid_id.ebics_keys_fn, passphrase=passphrase
- )
+ try:
+ keyring = EbicsKeyRing(
+ keys=self.ebics_userid_id.ebics_keys_fn, passphrase=passphrase
+ )
+ except (RuntimeError, ValueError) as err:
+ error = _("Error while accessing the EBICS Keys:")
+ error += "\n"
+ error += err.args[0]
+ raise UserError(error) from err
bank = EbicsBank(
keyring=keyring,
@@ -437,11 +446,22 @@ class EbicsXfer(models.TransientModel):
if self.ebics_config_id.ebics_version == "H003":
bank._order_number = self.ebics_config_id._get_order_number()
- user = EbicsUser(
- keyring=keyring,
- partnerid=self.ebics_config_id.ebics_partner,
- userid=self.ebics_userid_id.name,
- )
+ try:
+ user = EbicsUser(
+ keyring=keyring,
+ partnerid=self.ebics_config_id.ebics_partner,
+ userid=self.ebics_userid_id.name,
+ )
+ except ValueError as err:
+ error = _("Error while accessing the EBICS UserID:")
+ error += "\n"
+ err_str = err.args[0]
+ error += err.args[0]
+ if err_str == "unknown key format":
+ error += "\n"
+ error += _("Doublecheck your EBICS Passphrase and UserID settings.")
+ raise UserError(error) from err
+
signature_class = (
self.format_id.signature_class or self.ebics_userid_id.signature_class
)
@@ -460,24 +480,7 @@ class EbicsXfer(models.TransientModel):
return client
def _get_passphrase(self):
- passphrase = self.ebics_userid_id.ebics_passphrase
-
- if passphrase:
- return passphrase
-
- module = __name__.split("addons.")[1].split(".")[0]
- passphrase_view = self.env.ref("%s.ebics_xfer_view_form_passphrase" % module)
- return {
- "name": _("EBICS file transfer"),
- "res_id": self.id,
- "view_type": "form",
- "view_mode": "form",
- "res_model": "ebics.xfer",
- "view_id": passphrase_view.id,
- "target": "new",
- "context": self._context,
- "type": "ir.actions.act_window",
- }
+ return self.ebics_passphrase or self.ebics_userid_id.ebics_passphrase
def _file_format_methods(self):
"""
diff --git a/account_ebics/wizards/ebics_xfer.xml b/account_ebics/wizards/ebics_xfer.xml
index 0d28980..3d61d8d 100644
--- a/account_ebics/wizards/ebics_xfer.xml
+++ b/account_ebics/wizards/ebics_xfer.xml
@@ -20,6 +20,13 @@
required="1"
options="{'no_create': True, 'no_open': True}"
/>
+
+
+
+