[16.0] Fix passphrase handling

This commit is contained in:
Luc De Meyer 2023-03-25 19:23:33 +01:00
parent 21b2a524cd
commit 962b4d1177
4 changed files with 11 additions and 13 deletions

View File

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

View File

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

View File

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

View File

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