mirror of
https://github.com/brain-tec/account_ebics.git
synced 2025-08-13 22:25:35 +00:00
[IMP] account_ebics: correct support of ebics.userid.user_ids filter, ebics-key UI designation improvement
This commit is contained in:
@@ -113,29 +113,40 @@ 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.env.context.get("ebics_download"):
|
||||
download_formats = self.ebics_config_id.ebics_file_format_ids.filtered(
|
||||
avail_userids = self.ebics_config_id.ebics_userid_ids.filtered(
|
||||
lambda r: self.env.user.id in r.user_ids.ids
|
||||
)
|
||||
|
||||
if self.env.context.get("ebics_download"): # Download Form
|
||||
avail_formats = self.ebics_config_id.ebics_file_format_ids.filtered(
|
||||
lambda r: r.type == "down"
|
||||
)
|
||||
if len(download_formats) == 1:
|
||||
self.format_id = download_formats
|
||||
if len(ebics_userids) == 1:
|
||||
self.ebics_userid_id = ebics_userids
|
||||
else:
|
||||
transport_users = ebics_userids.filtered(
|
||||
lambda r: r.signature_class == "T"
|
||||
)
|
||||
if len(transport_users) == 1:
|
||||
self.ebics_userid_id = transport_users
|
||||
else:
|
||||
upload_formats = self.ebics_config_id.ebics_file_format_ids.filtered(
|
||||
avail_userids = avail_userids.filtered(
|
||||
lambda r: r.ui_designation in ["both", 'down']
|
||||
)
|
||||
else: # Upload Form
|
||||
avail_formats = self.ebics_config_id.ebics_file_format_ids.filtered(
|
||||
lambda r: r.type == "up"
|
||||
)
|
||||
if len(upload_formats) == 1:
|
||||
self.format_id = upload_formats
|
||||
if len(ebics_userids) == 1:
|
||||
self.ebics_userid_id = ebics_userids
|
||||
avail_userids = avail_userids.filtered(
|
||||
lambda r: r.ui_designation in ["both", "up"]
|
||||
)
|
||||
|
||||
if avail_formats and len(avail_formats) == 1:
|
||||
self.format_id = avail_formats
|
||||
else:
|
||||
self.format_id = False
|
||||
if avail_userids:
|
||||
if len(avail_userids) == 1:
|
||||
self.ebics_userid_id = avail_userids
|
||||
else:
|
||||
with_passphrs_userids = avail_userids.filtered(
|
||||
lambda r: r.ebics_passphrase_store
|
||||
)
|
||||
if len(with_passphrs_userids) == 1:
|
||||
self.ebics_userid_id = with_passphrs_userids
|
||||
else:
|
||||
self.ebics_userid_id = False
|
||||
|
||||
@api.onchange("upload_data")
|
||||
def _onchange_upload_data(self):
|
||||
|
@@ -16,7 +16,7 @@
|
||||
/>
|
||||
<field
|
||||
name="ebics_userid_id"
|
||||
domain="[('ebics_config_id', '=', ebics_config_id)]"
|
||||
domain="[('ebics_config_id', '=', ebics_config_id), ('user_ids.id', '=', uid), ('ui_designation', 'in', ['both', 'down'])]"
|
||||
required="1"
|
||||
options="{'no_create': True, 'no_open': True}"
|
||||
/>
|
||||
@@ -69,7 +69,7 @@
|
||||
/>
|
||||
<field
|
||||
name="ebics_userid_id"
|
||||
domain="[('ebics_config_id', '=', ebics_config_id)]"
|
||||
domain="[('ebics_config_id', '=', ebics_config_id), ('user_ids.id', '=', uid), ('ui_designation', 'in', ['both', 'up'])]"
|
||||
required="1"
|
||||
options="{'no_create': True, 'no_open': True}"
|
||||
/>
|
||||
@@ -143,7 +143,7 @@
|
||||
</record>
|
||||
|
||||
<record id="ebics_xfer_action_download" model="ir.actions.act_window">
|
||||
<field name="name">EBICS File Transfer</field>
|
||||
<field name="name">EBICS File Transfer - Download</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">ebics.xfer</field>
|
||||
<field name="view_mode">form</field>
|
||||
@@ -153,7 +153,7 @@
|
||||
</record>
|
||||
|
||||
<record id="ebics_xfer_action_upload" model="ir.actions.act_window">
|
||||
<field name="name">EBICS File Transfer</field>
|
||||
<field name="name">EBICS File Transfer - Upload</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">ebics.xfer</field>
|
||||
<field name="view_mode">form</field>
|
||||
|
Reference in New Issue
Block a user