From 6674cc4b35c4a7ae9ada6ca66c8e9ec79c613296 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Wed, 25 Mar 2026 11:55:20 +0100 Subject: [PATCH 01/10] [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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py index 1c0ad01..f3a1635 100644 --- a/account_ebics/wizards/ebics_xfer.py +++ b/account_ebics/wizards/ebics_xfer.py @@ -236,8 +236,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,7 +321,7 @@ class EbicsXfer(models.TransientModel): ) tb = "".join(format_exception(*exc_info())) self.note += f"\n{tb}" - else: + finally: # mark received data so that it is not included in further # downloads trans_id = client.last_trans_id From 747e5a81c8a924a50cbcc7f9aa6be5f0eac23611 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Tue, 14 Apr 2026 15:52:51 +0200 Subject: [PATCH 02/10] [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 | 25 ++++++++++-------- .../views/account_batch_payment_views.xml | 2 +- 4 files changed, 42 insertions(+), 12 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 fc98660..f6699de 100644 --- a/account_ebics_batch_payment/models/account_batch_payment.py +++ b/account_ebics_batch_payment/models/account_batch_payment.py @@ -1,34 +1,37 @@ -# Copyright 2009-2024 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 = self.env._("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( self.env._( "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 0f7c8f8..02398d1 100644 --- a/account_ebics_batch_payment/views/account_batch_payment_views.xml +++ b/account_ebics_batch_payment/views/account_batch_payment_views.xml @@ -9,7 +9,7 @@ From c6e26601289a2f5748bec9ae8ed76638765abb20 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Tue, 14 Apr 2026 19:16:57 +0200 Subject: [PATCH 03/10] [IMP] payment order: hide ebics_upload button on non-ebics journals --- account_ebics_payment_order/__manifest__.py | 2 +- .../models/account_payment_mode.py | 2 +- .../models/account_payment_order.py | 39 ++++++++++--------- .../views/account_payment_order_views.xml | 2 +- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/account_ebics_payment_order/__manifest__.py b/account_ebics_payment_order/__manifest__.py index 92980d2..89f6c9d 100644 --- a/account_ebics_payment_order/__manifest__.py +++ b/account_ebics_payment_order/__manifest__.py @@ -1,4 +1,4 @@ -# Copyright 2009-2024 Noviat. +# Copyright 2015 Noviat. # License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). { diff --git a/account_ebics_payment_order/models/account_payment_mode.py b/account_ebics_payment_order/models/account_payment_mode.py index 9ab2dc6..00bec22 100644 --- a/account_ebics_payment_order/models/account_payment_mode.py +++ b/account_ebics_payment_order/models/account_payment_mode.py @@ -1,4 +1,4 @@ -# Copyright 2009-2024 Noviat. +# 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 0859f08..85d9bd3 100644 --- a/account_ebics_payment_order/models/account_payment_order.py +++ b/account_ebics_payment_order/models/account_payment_order.py @@ -1,20 +1,28 @@ -# Copyright 2009-2024 Noviat. +# 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() ebics_format_id = self.payment_mode_id.ebics_format_id if not ebics_format_id: raise UserError( - _("Missing EBICS File Format setting on your Payment Mode.") + self.env._("Missing EBICS File Format setting on your Payment Mode.") ) ctx.update( { @@ -27,14 +35,14 @@ class AccountPaymentOrder(models.Model): ) if not attach: raise UserError( - _( - "This payment order doesn't contains attachements." - "\nPlease generate first the Payment Order file first." + self.env._( + "This payment order doesn't contains attachments." + "\nPlease generate first the Payment Order file." ) ) elif len(attach) > 1: raise UserError( - _( + self.env._( "This payment order contains multiple attachments." "\nPlease remove the obsolete attachments or upload " "the payment order file via the " @@ -42,24 +50,17 @@ 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: + origin = self.env._("Payment Order") + ": " + self.name + if not self.journal_id.ebics_config_id: raise UserError( - _( + self.env._( "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, @@ -75,7 +76,7 @@ class AccountPaymentOrder(models.Model): ebics_xfer._onchange_upload_data() view = self.env.ref("account_ebics.ebics_xfer_view_form_upload") act = { - "name": _("EBICS Upload"), + "name": self.env._("EBICS Upload"), "view_mode": "form", "res_model": "ebics.xfer", "view_id": view.id, 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 a7ba6c8..b2c1f3f 100644 --- a/account_ebics_payment_order/views/account_payment_order_views.xml +++ b/account_ebics_payment_order/views/account_payment_order_views.xml @@ -12,7 +12,7 @@