[IMP] account_ebics: hide process button on ebics_file when no download process

This commit is contained in:
Luc De Meyer 2025-01-03 15:01:54 +01:00
parent 49c764d7d4
commit 250f5bcc3c
14 changed files with 453 additions and 389 deletions

View File

@ -1,4 +1,4 @@
# Copyright 2009-2024 Noviat.
# Copyright 2009-2025 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl).
{

View File

@ -0,0 +1,15 @@
# Copyright 2009-2025 Noviat.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
def migrate(cr, version):
cr.execute( # pylint: disable=E8103
"""
UPDATE ebics_file ef
SET state = 'done'
FROM ebics_file_format eff
WHERE ef.format_id = eff.id
AND eff.type = 'down'
AND eff.download_process_method IS NULL;
"""
)

View File

@ -1,4 +1,4 @@
# Copyright 2009-2024 Noviat.
# Copyright 2009-2025 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl).
import base64
@ -36,7 +36,10 @@ class EbicsFile(models.Model):
format_id = fields.Many2one(
comodel_name="ebics.file.format", string="EBICS File Formats", readonly=True
)
type = fields.Selection(related="format_id.type", readonly=True)
download_process_method = fields.Selection(
related="format_id.download_process_method"
)
type = fields.Selection(related="format_id.type")
date_from = fields.Date(
readonly=True, help="'Date From' as entered in the download wizard."
)

View File

@ -1,4 +1,4 @@
<?xml version="1.0" ?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="ebics_config_view_list" model="ir.ui.view">
@ -71,11 +71,20 @@
</group>
</group>
<notebook>
<page string="EBICS Users" groups="account_ebics.group_ebics_manager">
<page
string="EBICS Users"
groups="account_ebics.group_ebics_manager"
>
<field name="ebics_userid_ids" readonly="state != 'draft'" />
</page>
<page string="File Formats" groups="account_ebics.group_ebics_manager">
<field name="ebics_file_format_ids" readonly="state != 'draft'" />
<page
string="File Formats"
groups="account_ebics.group_ebics_manager"
>
<field
name="ebics_file_format_ids"
readonly="state != 'draft'"
/>
</page>
</notebook>
</form>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" ?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="ebics_file_format_view_list" model="ir.ui.view">

View File

@ -1,4 +1,4 @@
<?xml version="1.0" ?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="ebics_file_view_search" model="ir.ui.view">
@ -77,9 +77,10 @@
<field name="arch" type="xml">
<form string="EBICS File" create="false">
<header>
<field name="download_process_method" invisible="1" />
<button
name="set_to_draft"
invisible="state != 'done'"
invisible="not download_process_method or state != 'done'"
string="Set to Draft"
type="object"
groups="account.group_account_manager"
@ -87,7 +88,7 @@
<button
name="process"
class="oe_highlight"
invisible="state != 'draft'"
invisible="not download_process_method or state != 'draft'"
string="Process"
type="object"
groups="account.group_account_invoice"
@ -95,28 +96,38 @@
/>
<button
name="set_to_done"
invisible="state != 'draft'"
invisible="not download_process_method or state != 'draft'"
string="Set to Done"
type="object"
groups="account.group_account_manager"
/>
<field name="state" widget="statusbar" />
<field
name="state"
widget="statusbar"
invisible="not download_process_method"
/>
</header>
<group colspan="4" col="4">
<field name="date" string="Download Date" />
<group name="main">
<group name="main-full-screen" colspan="2" col="2">
<field name="name" />
<field name="data" filename="name" />
<field name="format_id" />
<field name="date_from" />
<field name="date_to" />
</group>
<group name="main-left">
<field name="date" string="Download Date" />
<field name="user_id" />
<field name="ebics_userid_id" />
</group>
<group name="main-right">
<field name="date_from" />
<field name="date_to" />
<field
name="company_ids"
widget="many2many_tags"
groups="base.group_multi_company"
/>
</group>
</group>
<notebook>
<page string="Additional Information">
<field name="note" nolabel="1" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" ?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="ebics_userid_view_list" model="ir.ui.view">
@ -126,25 +126,42 @@
<field name="ebics_key_x509" readonly="state != 'draft'" />
</group>
</group>
<group name="dn" invisible="not ebics_key_x509" readonly="state != 'draft'">
<group
name="dn"
invisible="not ebics_key_x509"
readonly="state != 'draft'"
>
<div colspan="2" col="1">
<strong
>Distinguished Name attributes used to create self-signed X.509 certificates:</strong>
</div>
<group name="dn_l">
<field name="ebics_key_x509_dn_cn" readonly="state != 'draft'" />
<field
name="ebics_key_x509_dn_cn"
readonly="state != 'draft'"
/>
<field name="ebics_key_x509_dn_o" readonly="state != 'draft'" />
<field name="ebics_key_x509_dn_l" readonly="state != 'draft'" />
<field name="ebics_key_x509_dn_c" readonly="state != 'draft'" />
</group>
<group name="dn_r">
<field name="ebics_key_x509_dn_e" readonly="state != 'draft'" />
<field name="ebics_key_x509_dn_ou" readonly="state != 'draft'" />
<field name="ebics_key_x509_dn_st" readonly="state != 'draft'" />
<field
name="ebics_key_x509_dn_ou"
readonly="state != 'draft'"
/>
<field
name="ebics_key_x509_dn_st"
readonly="state != 'draft'"
/>
</group>
</group>
<group name="files">
<group colspan="2" name="ebics_ini_letter" invisible="not ebics_ini_letter">
<group
colspan="2"
name="ebics_ini_letter"
invisible="not ebics_ini_letter"
>
<field name="ebics_ini_letter_fn" invisible="1" />
<field name="ebics_ini_letter" filename="ebics_ini_letter_fn" />
</group>
@ -154,7 +171,10 @@
invisible="not ebics_public_bank_keys"
>
<field name="ebics_public_bank_keys_fn" invisible="1" />
<field name="ebics_public_bank_keys" filename="ebics_public_bank_keys_fn" />
<field
name="ebics_public_bank_keys"
filename="ebics_public_bank_keys_fn"
/>
</group>
</group>
</form>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" ?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<menuitem

View File

@ -1,4 +1,4 @@
# Copyright 2009-2024 Noviat.
# Copyright 2009-2025 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl).
import base64
@ -612,6 +612,7 @@ class EbicsXfer(models.TransientModel):
"date_from": self.date_from,
"date_to": self.date_to,
"format_id": file_format.id,
"state": file_format.download_process_method and "draft" or "done",
"user_id": self._uid,
"ebics_userid_id": self.ebics_userid_id.id,
"company_ids": self.ebics_config_id.company_ids.ids,

View File

@ -94,7 +94,10 @@
readonly="context.get('active_model') == 'account.payment.order'"
/>
<field name="order_type" />
<field name="test_mode" invisible="order_type not in ('FUL', 'BTU')" />
<field
name="test_mode"
invisible="order_type not in ('FUL', 'BTU')"
/>
</group>
<footer>
<button

View File

@ -1,4 +1,4 @@
# Copyright 2009-2024 Noviat.
# Copyright 2009-2025 Noviat.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{

View File

@ -182,7 +182,9 @@ class EbicsBatchLog(models.Model):
return file_ids
def _ebics_process(self, import_dict):
to_process = self.file_ids.filtered(lambda r: r.state == "draft")
to_process = self.file_ids.filtered(
lambda r: r.download_process_method and r.state == "draft"
)
for ebics_file in to_process:
ebics_file.process()