From 921a7a366ffbcc4a3e0d8e814f895b32bfaab649 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Sun, 11 Oct 2026 15:48:31 +0200 Subject: [PATCH] [IMP] Add upload state tracking on EBICS payment files account_ebics: - Add pain_state and ebics_order_number to ebics.file - Set these fields after a successful upload - Add neutralized property to api.Environment account_ebics_batch_payment: - Add EBICS notebook page with upload info to batch payment form - Post chatter message with OrderID after upload account_ebics_payment_order: - Fix broken postprocess: replace deprecated active_model/active_id context keys with model/id --- account_ebics_batch_payment/__manifest__.py | 2 +- .../models/account_batch_payment.py | 34 +++++++++++++++++-- .../views/account_batch_payment_views.xml | 13 +++++++ 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/account_ebics_batch_payment/__manifest__.py b/account_ebics_batch_payment/__manifest__.py index f66ac1c..2888320 100644 --- a/account_ebics_batch_payment/__manifest__.py +++ b/account_ebics_batch_payment/__manifest__.py @@ -4,7 +4,7 @@ { "name": "EBICS - Batch Payments (Odoo Enterprise)", "summary": "Send an Odoo Enterprise batch payment to the bank over EBICS", - "version": "19.0.1.2.0", + "version": "19.0.1.3.0", "license": "LGPL-3", "author": "Noviat", "website": "https://www.noviat.com/", diff --git a/account_ebics_batch_payment/models/account_batch_payment.py b/account_ebics_batch_payment/models/account_batch_payment.py index f6eecf9..1c99c10 100644 --- a/account_ebics_batch_payment/models/account_batch_payment.py +++ b/account_ebics_batch_payment/models/account_batch_payment.py @@ -8,19 +8,47 @@ from odoo.exceptions import UserError class AccountBatchPayment(models.Model): _inherit = "account.batch.payment" + ebics_config_id = fields.Many2one( + comodel_name="ebics.config", + related="journal_id.ebics_config_id", + ) + ebics_file_id = fields.Many2one( + comodel_name="ebics.file", + string="EBICS Upload File", + readonly=True, + ) + ebics_pain_state = fields.Selection( + related="ebics_file_id.pain_state", + string="EBICS Upload Status", + ) + ebics_order_number = fields.Char( + related="ebics_file_id.ebics_order_number", + string="EBICS OrderID", + ) hide_ebics_upload = fields.Boolean( compute="_compute_hide_ebics_upload", default=True ) - @api.depends("journal_id.ebics_config_id", "file_generation_enabled", "state") + @api.depends( + "journal_id.ebics_config_id", + "file_generation_enabled", + "state", + "ebics_file_id.pain_state", + ) def _compute_hide_ebics_upload(self): for rec in self: rec.hide_ebics_upload = ( - not rec.journal_id.ebics_config_id + self.env.neutralized + or not rec.journal_id.ebics_config_id or not rec.file_generation_enabled or rec.state != "sent" + or rec.ebics_pain_state == "uploaded" ) + def export_batch_payment(self): + self.filtered("ebics_file_id").write({"ebics_file_id": False}) + return super().export_batch_payment() + def ebics_upload(self): self.ensure_one() ctx = self.env.context.copy() @@ -38,6 +66,8 @@ class AccountBatchPayment(models.Model): "default_upload_data": self.export_file, "default_upload_fname": self.export_filename, "origin": origin, + "model": self._name, + "id": self.id, } ) 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 3bdf1fd..b247106 100644 --- a/account_ebics_batch_payment/views/account_batch_payment_views.xml +++ b/account_ebics_batch_payment/views/account_batch_payment_views.xml @@ -14,6 +14,19 @@ class="oe_highlight" /> + + + + + + + + +