From 09b35600ffb75a00ce072cf24c1833477f130c52 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Wed, 25 Mar 2026 11:55:20 +0100 Subject: [PATCH 1/6] [FIX] ebics download: execute always client.confirm_download() Certain banks expect always a confirm_download, also in case of success=False. --- account_ebics/wizards/ebics_xfer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py index 2034ca8..e300f09 100644 --- a/account_ebics/wizards/ebics_xfer.py +++ b/account_ebics/wizards/ebics_xfer.py @@ -237,8 +237,8 @@ class EbicsXfer(models.TransientModel): date_from = self.date_from and self.date_from.isoformat() or None date_to = self.date_to and self.date_to.isoformat() or None for df in download_formats: + success = False try: - success = False if df.order_type == "BTD": btf = BusinessTransactionFormat( df.btf_service, @@ -321,8 +321,8 @@ class EbicsXfer(models.TransientModel): order_type=df.order_type, ) tb = "".join(format_exception(*exc_info())) - self.note += "\n%s" % tb - else: + self.note += f"\n{tb}" + finally: # mark received data so that it is not included in further # downloads trans_id = client.last_trans_id From e7df306161a711de3618ad657c075cdef912dea4 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Tue, 14 Apr 2026 15:52:51 +0200 Subject: [PATCH 2/6] [IMP] batch payment: hide ebics_upload button on non-ebics journals --- account_ebics/models/__init__.py | 1 + account_ebics/models/account_journal.py | 26 ++++++++++++++++++ .../models/account_batch_payment.py | 27 ++++++++++--------- .../views/account_batch_payment_views.xml | 3 ++- 4 files changed, 44 insertions(+), 13 deletions(-) create mode 100644 account_ebics/models/account_journal.py diff --git a/account_ebics/models/__init__.py b/account_ebics/models/__init__.py index 0a211c1..4b04a91 100644 --- a/account_ebics/models/__init__.py +++ b/account_ebics/models/__init__.py @@ -1,5 +1,6 @@ from . import fintech_ebics_register from . import account_bank_statement +from . import account_journal from . import ebics_config from . import ebics_file from . import ebics_file_format diff --git a/account_ebics/models/account_journal.py b/account_ebics/models/account_journal.py new file mode 100644 index 0000000..199858c --- /dev/null +++ b/account_ebics/models/account_journal.py @@ -0,0 +1,26 @@ +# Copyright 2026 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +from odoo import api, fields, models + + +class AccountJournal(models.Model): + _inherit = "account.journal" + + ebics_config_ids = fields.Many2many( + comodel_name="ebics.config", + relation="account_journal_ebics_config_rel", + readonly=True, + ) + ebics_config_id = fields.Many2one( + comodel_name="ebics.config", + compute="_compute_ebics_config_id", + compute_sudo=True, + ) + + @api.depends("ebics_config_ids") + def _compute_ebics_config_id(self): + for rec in self: + rec.ebics_config_id = rec.ebics_config_ids.filtered( + lambda r: r.state == "confirm" + )[:1] diff --git a/account_ebics_batch_payment/models/account_batch_payment.py b/account_ebics_batch_payment/models/account_batch_payment.py index f80ed4e..f942e7c 100644 --- a/account_ebics_batch_payment/models/account_batch_payment.py +++ b/account_ebics_batch_payment/models/account_batch_payment.py @@ -1,32 +1,35 @@ -# Copyright 2009-2023 Noviat. +# Copyright 2020 Noviat. # License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). -from odoo import _, models +from odoo import _, fields, models from odoo.exceptions import UserError class AccountBatchPayment(models.Model): _inherit = "account.batch.payment" + hide_ebics_upload = fields.Boolean(compute="_compute_hide_ebics_upload") + + def _compute_hide_ebics_upload(self): + for rec in self: + rec.hide_ebics_upload = ( + not rec.journal_id.ebics_config_id + or not rec.file_generation_enabled + or rec.state != "sent" + ) + def ebics_upload(self): self.ensure_one() ctx = self.env.context.copy() origin = _("Batch Payment") + ": " + self.name - ebics_config = self.env["ebics.config"].search( - [ - ("journal_ids", "=", self.journal_id.id), - ("state", "=", "confirm"), - ] - ) - if not ebics_config: + if not self.journal_id.ebics_config_id: raise UserError( - _("No active EBICS configuration available " "for the selected bank.") + _("No active EBICS configuration available for the selected bank.") ) - if len(ebics_config) == 1: - ctx["default_ebics_config_id"] = ebics_config.id ctx.update( { + "default_ebics_config_id": self.journal_id.ebics_config_id.id, "default_upload_data": self.export_file, "default_upload_fname": self.export_filename, "origin": origin, diff --git a/account_ebics_batch_payment/views/account_batch_payment_views.xml b/account_ebics_batch_payment/views/account_batch_payment_views.xml index 4fa3326..ed9d7f0 100644 --- a/account_ebics_batch_payment/views/account_batch_payment_views.xml +++ b/account_ebics_batch_payment/views/account_batch_payment_views.xml @@ -7,10 +7,11 @@ From e464383077d2c2e127ffd88794caa72a54952cb3 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Tue, 14 Apr 2026 19:16:57 +0200 Subject: [PATCH 3/6] [IMP] payment order: hide ebics_upload button on non-ebics journals --- account_ebics_payment_order/__manifest__.py | 4 +-- .../models/account_payment_mode.py | 4 +-- .../models/account_payment_order.py | 29 ++++++++++--------- .../views/account_payment_order_views.xml | 3 +- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/account_ebics_payment_order/__manifest__.py b/account_ebics_payment_order/__manifest__.py index 184bb7c..8438662 100644 --- a/account_ebics_payment_order/__manifest__.py +++ b/account_ebics_payment_order/__manifest__.py @@ -1,5 +1,5 @@ -# Copyright 2009-2024 Noviat. -# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). +# Copyright 2015 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). { "name": "Upload Payment Order via EBICS", diff --git a/account_ebics_payment_order/models/account_payment_mode.py b/account_ebics_payment_order/models/account_payment_mode.py index 92a9fc4..00bec22 100644 --- a/account_ebics_payment_order/models/account_payment_mode.py +++ b/account_ebics_payment_order/models/account_payment_mode.py @@ -1,5 +1,5 @@ -# Copyright 2009-2024 Noviat. -# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl). +# Copyright 2015 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lpgl). from odoo import fields, models diff --git a/account_ebics_payment_order/models/account_payment_order.py b/account_ebics_payment_order/models/account_payment_order.py index 14bfa7d..ea0b53e 100644 --- a/account_ebics_payment_order/models/account_payment_order.py +++ b/account_ebics_payment_order/models/account_payment_order.py @@ -1,13 +1,21 @@ -# Copyright 2009-2024 Noviat. -# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). +# Copyright 2015 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). -from odoo import _, models +from odoo import _, fields, models from odoo.exceptions import UserError class AccountPaymentOrder(models.Model): _inherit = "account.payment.order" + hide_ebics_upload = fields.Boolean(compute="_compute_hide_ebics_upload") + + def _compute_hide_ebics_upload(self): + for rec in self: + rec.hide_ebics_upload = ( + not rec.journal_id.ebics_config_id or rec.state != "generated" + ) + def ebics_upload(self): self.ensure_one() ctx = self.env.context.copy() @@ -28,8 +36,8 @@ class AccountPaymentOrder(models.Model): if not attach: raise UserError( _( - "This payment order doesn't contains attachements." - "\nPlease generate first the Payment Order file first." + "This payment order doesn't contains attachments." + "\nPlease generate first the Payment Order file." ) ) elif len(attach) > 1: @@ -43,23 +51,16 @@ class AccountPaymentOrder(models.Model): ) else: origin = _("Payment Order") + ": " + self.name - ebics_config = self.env["ebics.config"].search( - [ - ("journal_ids", "=", self.journal_id.id), - ("state", "=", "confirm"), - ] - ) - if not ebics_config: + if not self.journal_id.ebics_config_id: raise UserError( _( "No active EBICS configuration available " "for the selected bank." ) ) - if len(ebics_config) == 1: - ctx["default_ebics_config_id"] = ebics_config.id ctx.update( { + "default_ebics_config_id": self.journal_id.ebics_config_id.id, "default_upload_data": attach.datas, "default_upload_fname": attach.name, "origin": origin, diff --git a/account_ebics_payment_order/views/account_payment_order_views.xml b/account_ebics_payment_order/views/account_payment_order_views.xml index 46bad82..0a23fad 100644 --- a/account_ebics_payment_order/views/account_payment_order_views.xml +++ b/account_ebics_payment_order/views/account_payment_order_views.xml @@ -7,10 +7,11 @@