[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 7425d6003b
commit 30313e58a4
11 changed files with 113 additions and 81 deletions

View File

@ -1,9 +1,9 @@
# Copyright 2009-2024 Noviat. # Copyright 2009-2025 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). # License LGPL-3 or later (http://www.gnu.org/licenses/lgpl).
{ {
"name": "EBICS banking protocol", "name": "EBICS banking protocol",
"version": "16.0.1.10.3", "version": "16.0.2.0.0",
"license": "LGPL-3", "license": "LGPL-3",
"author": "Noviat", "author": "Noviat",
"website": "https://www.noviat.com/", "website": "https://www.noviat.com/",

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). # License LGPL-3 or later (http://www.gnu.org/licenses/lgpl).
import base64 import base64
@ -36,7 +36,10 @@ class EbicsFile(models.Model):
format_id = fields.Many2one( format_id = fields.Many2one(
comodel_name="ebics.file.format", string="EBICS File Formats", readonly=True 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( date_from = fields.Date(
readonly=True, help="'Date From' as entered in the download wizard." 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> <odoo>
<record id="ebics_config_view_tree" model="ir.ui.view"> <record id="ebics_config_view_tree" model="ir.ui.view">

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
<?xml version="1.0" ?> <?xml version="1.0" encoding="utf-8" ?>
<odoo> <odoo>
<menuitem <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). # License LGPL-3 or later (http://www.gnu.org/licenses/lgpl).
import base64 import base64
@ -603,6 +603,7 @@ class EbicsXfer(models.TransientModel):
"date_from": self.date_from, "date_from": self.date_from,
"date_to": self.date_to, "date_to": self.date_to,
"format_id": file_format.id, "format_id": file_format.id,
"state": file_format.download_process_method and "draft" or "done",
"user_id": self._uid, "user_id": self._uid,
"ebics_userid_id": self.ebics_userid_id.id, "ebics_userid_id": self.ebics_userid_id.id,
"company_ids": self.ebics_config_id.company_ids.ids, "company_ids": self.ebics_config_id.company_ids.ids,

View File

@ -1,9 +1,9 @@
# Copyright 2009-2023 Noviat. # Copyright 2009-2025 Noviat.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
"name": "EBICS Files batch import", "name": "EBICS Files batch import",
"version": "16.0.1.0.0", "version": "16.0.1.0.1",
"license": "AGPL-3", "license": "AGPL-3",
"author": "Noviat", "author": "Noviat",
"website": "https://www.noviat.com/", "website": "https://www.noviat.com/",

View File

@ -179,7 +179,9 @@ class EbicsBatchLog(models.Model):
return file_ids return file_ids
def _ebics_process(self, import_dict): 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: for ebics_file in to_process:
ebics_file.process() ebics_file.process()