Merge pull request #73 from Noviat/16-fix-passphrase

[16.0] Fix passphrase handling
This commit is contained in:
Luc De Meyer 2023-03-26 11:18:37 +02:00 committed by GitHub
commit 025ad1f4b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 13 deletions

View File

@ -80,6 +80,7 @@ class EbicsConfig(models.Model):
ebics_userid_ids = fields.One2many(
comodel_name="ebics.userid",
inverse_name="ebics_config_id",
string="EBICS UserID",
readonly=True,
states={"draft": [("readonly", False)]},
help="Human users or a technical system that is/are "
@ -128,7 +129,7 @@ class EbicsConfig(models.Model):
comodel_name="ebics.file.format",
column1="config_id",
column2="format_id",
string="EBICS File Formats",
string="EBICS File Format",
readonly=True,
states={"draft": [("readonly", False)]},
)

View File

@ -91,7 +91,7 @@
<field
name="ebics_passphrase"
password="True"
attrs="{'required': [('state', '=', 'draft')]}"
attrs="{'required': [('ebics_passphrase_store', '=', True)], 'invisible': [('state', '!=', 'draft')]}"
/>
<field name="ebics_passphrase_store" />
<field name="active" />

View File

@ -65,6 +65,9 @@ class EbicsXfer(models.TransientModel):
ebics_passphrase_stored = fields.Char(
string="EBICS Stored Passphrase", related="ebics_userid_id.ebics_passphrase"
)
ebics_passphrase_store = fields.Boolean(
related="ebics_userid_id.ebics_passphrase_store"
)
date_from = fields.Date()
date_to = fields.Date()
upload_data = fields.Binary(string="File to Upload")
@ -134,10 +137,6 @@ class EbicsXfer(models.TransientModel):
if len(ebics_userids) == 1:
self.ebics_userid_id = ebics_userids
@api.onchange("ebics_userid_id")
def _onchange_ebics_userid_id(self):
self.ebics_passphrase = self.ebics_passphrase_stored
@api.onchange("upload_data")
def _onchange_upload_data(self):
self.upload_fname_dummy = self.upload_fname
@ -484,7 +483,7 @@ class EbicsXfer(models.TransientModel):
return client
def _get_passphrase(self):
return self.ebics_passphrase or self.ebics_userid_id.ebics_passphrase
return self.ebics_passphrase or self.ebics_passphrase_stored
def _file_format_methods(self):
"""

View File

@ -23,10 +23,9 @@
<field
name="ebics_passphrase"
password="True"
required="1"
attrs="{'invisible': [('ebics_passphrase_stored', '!=', False)]}"
attrs="{'invisible': [('ebics_passphrase_store', '=', True)], 'required': [('ebics_passphrase_store', '=', False)]}"
/>
<field name="ebics_passphrase_stored" invisible="1" />
<field name="ebics_passphrase_store" invisible="1" />
<field name="date_from" />
<field name="date_to" />
<field
@ -72,10 +71,9 @@
<field
name="ebics_passphrase"
password="True"
required="1"
attrs="{'invisible': [('ebics_passphrase_stored', '!=', False)]}"
attrs="{'invisible': [('ebics_passphrase_store', '=', True)], 'required': [('ebics_passphrase_store', '=', False)]}"
/>
<field name="ebics_passphrase_stored" invisible="1" />
<field name="ebics_passphrase_store" invisible="1" />
<separator string="Select your file :" colspan="2" />
<field name="upload_data" filename="upload_fname" required="1" />
<field name="upload_fname" invisible="1" />