diff --git a/account_ebics_batch_payment/__manifest__.py b/account_ebics_batch_payment/__manifest__.py
index 2888320..22e5bea 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.3.0",
+ "version": "19.0.1.3.1",
"license": "LGPL-3",
"author": "Noviat",
"website": "https://www.noviat.com/",
diff --git a/account_ebics_batch_payment/tests/__init__.py b/account_ebics_batch_payment/tests/__init__.py
new file mode 100644
index 0000000..2684399
--- /dev/null
+++ b/account_ebics_batch_payment/tests/__init__.py
@@ -0,0 +1 @@
+from . import test_batch_payment_upload
diff --git a/account_ebics_batch_payment/tests/test_batch_payment_upload.py b/account_ebics_batch_payment/tests/test_batch_payment_upload.py
new file mode 100644
index 0000000..87cbd6d
--- /dev/null
+++ b/account_ebics_batch_payment/tests/test_batch_payment_upload.py
@@ -0,0 +1,77 @@
+# Copyright 2026 Noviat.
+# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl).
+
+import base64
+from unittest.mock import patch
+
+from odoo.exceptions import UserError
+from odoo.tests import tagged
+
+from odoo.addons.account_ebics.tests.common import EbicsTestCommon, FakeEbicsClient
+
+
+@tagged("post_install", "-at_install")
+class TestBatchPaymentUpload(EbicsTestCommon):
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+ cls.journal = cls._create_bank_journal("TBP", "FR7630004000031234567890143")
+ cls.ff_cct = cls.env.ref("account_ebics.ebics_ff_CCT")
+ cls.method = cls.env.ref("account.account_payment_method_manual_out")
+
+ def _batch(self, state="sent"):
+ batch = self.env["account.batch.payment"].create(
+ {
+ "journal_id": self.journal.id,
+ "batch_type": "outbound",
+ "payment_method_id": self.method.id,
+ "export_file": base64.b64encode(b"pain.001"),
+ "export_filename": "batch.xml",
+ }
+ )
+ # Without payments the batch stays in draft: set the state directly.
+ batch.state = state
+ return batch
+
+ def _generating_files(self):
+ batch_class = type(self.env["account.batch.payment"])
+ return patch.object(
+ batch_class, "_get_methods_generating_files", return_value=["manual"]
+ )
+
+ def test_hide_ebics_upload(self):
+ with self._generating_files():
+ self.assertFalse(self._batch().hide_ebics_upload)
+ self.assertTrue(self._batch(state="draft").hide_ebics_upload)
+ batch = self._batch()
+ batch.ebics_file_id = self.env["ebics.file"].create(
+ {"name": "batch.xml", "date": "2026-10-13", "pain_state": "uploaded"}
+ )
+ self.assertTrue(batch.hide_ebics_upload)
+ # no file generation for this payment method
+ self.assertTrue(self._batch().hide_ebics_upload)
+
+ def test_upload_requires_ebics_config(self):
+ self.ebics_config.journal_ids = False
+ with self.assertRaises(UserError):
+ self._batch().ebics_upload()
+
+ def test_upload_format_from_payment_method(self):
+ self.method.ebics_file_format_id = self.ff_cct
+ action = self._batch().ebics_upload()
+ wizard = self.env["ebics.xfer"].browse(action["res_id"])
+ self.assertEqual(wizard.format_id, self.ff_cct)
+ self.assertEqual(wizard.upload_fname, "batch.xml")
+
+ def test_upload(self):
+ self.method.ebics_file_format_id = self.ff_cct
+ batch = self._batch()
+ action = batch.ebics_upload()
+ wizard = self.env["ebics.xfer"].browse(action["res_id"])
+ with self._fake_client(FakeEbicsClient(order_id="N088")) as client:
+ wizard.with_context(**action["context"]).ebics_upload()
+ self.assertEqual(client.uploads[0][1], b"pain.001")
+ self.assertEqual(batch.ebics_order_number, "N088")
+ self.assertEqual(batch.ebics_pain_state, "uploaded")
+ self.assertIn(f"Batch Payment: {batch.name}", batch.ebics_file_id.note)
+ self.assertTrue(any("N088" in msg.body for msg in batch.message_ids))