diff --git a/account_ebics_batch_payment/README.rst b/account_ebics_batch_payment/README.rst new file mode 100644 index 0000000..1a28c97 --- /dev/null +++ b/account_ebics_batch_payment/README.rst @@ -0,0 +1,24 @@ +.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg + :target: https://www.gnu.org/licenses/lpgl + :alt: License: AGPL-3 + +============================== +Upload Batch Payment via EBICS +============================== + +This module allows to upload a Batch Payment to the bank via the EBICS protocol. + +Installation +============ + +This module depends upon the following modules: + +- account_ebics (cf. https://github.com/Noviat/account_ebics) +- account_ebics_oe (cf. https://github.com/Noviat/account_ebics) +- account_batch_payment (Odoo Enterprise) + +Usage +===== + +Create your Batch Payment and generate the bank file. +Upload the generated file via the 'EBICS Upload' button on the batch payment. diff --git a/account_ebics_batch_payment/__init__.py b/account_ebics_batch_payment/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/account_ebics_batch_payment/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/account_ebics_batch_payment/__manifest__.py b/account_ebics_batch_payment/__manifest__.py new file mode 100644 index 0000000..fafe9c9 --- /dev/null +++ b/account_ebics_batch_payment/__manifest__.py @@ -0,0 +1,13 @@ +# Copyright 2009-2022 Noviat. +# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl). + +{ + "name": "Upload Batch Payment via EBICS", + "version": "14.0.1.1.0", + "license": "LGPL-3", + "author": "Noviat", + "category": "Accounting & Finance", + "depends": ["account_ebics", "account_batch_payment"], + "data": ["views/account_batch_payment_views.xml"], + "installable": True, +} diff --git a/account_ebics_batch_payment/models/__init__.py b/account_ebics_batch_payment/models/__init__.py new file mode 100644 index 0000000..015ee74 --- /dev/null +++ b/account_ebics_batch_payment/models/__init__.py @@ -0,0 +1 @@ +from . import account_batch_payment diff --git a/account_ebics_batch_payment/models/account_batch_payment.py b/account_ebics_batch_payment/models/account_batch_payment.py new file mode 100644 index 0000000..033b610 --- /dev/null +++ b/account_ebics_batch_payment/models/account_batch_payment.py @@ -0,0 +1,53 @@ +# Copyright 2009-2022 Noviat. +# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl). + +from odoo import _, models +from odoo.exceptions import UserError + + +class AccountBatchPayment(models.Model): + _inherit = "account.batch.payment" + + 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: + 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_upload_data": self.export_file, + "default_upload_fname": self.export_filename, + "origin": origin, + "force_comany": self.journal_id.company_id.id, + } + ) + + ebics_xfer = self.env["ebics.xfer"].with_context(ctx).create({}) + ebics_xfer._onchange_ebics_config_id() + ebics_xfer._onchange_upload_data() + ebics_xfer._onchange_format_id() + view = self.env.ref("account_ebics.ebics_xfer_view_form_upload") + act = { + "name": _("EBICS Upload"), + "view_type": "form", + "view_mode": "form", + "res_model": "ebics.xfer", + "view_id": view.id, + "res_id": ebics_xfer.id, + "type": "ir.actions.act_window", + "target": "new", + "context": ctx, + } + return act diff --git a/account_ebics_batch_payment/static/description/icon.png b/account_ebics_batch_payment/static/description/icon.png new file mode 100644 index 0000000..889d129 Binary files /dev/null and b/account_ebics_batch_payment/static/description/icon.png differ diff --git a/account_ebics_batch_payment/views/account_batch_payment_views.xml b/account_ebics_batch_payment/views/account_batch_payment_views.xml new file mode 100644 index 0000000..2b7daf3 --- /dev/null +++ b/account_ebics_batch_payment/views/account_batch_payment_views.xml @@ -0,0 +1,22 @@ + + + + + + account.batch.payment.form + account.batch.payment + + + + + + + + diff --git a/setup/account_ebics_batch_payment/odoo/addons/account_ebics_batch_payment b/setup/account_ebics_batch_payment/odoo/addons/account_ebics_batch_payment new file mode 120000 index 0000000..1e5ed4c --- /dev/null +++ b/setup/account_ebics_batch_payment/odoo/addons/account_ebics_batch_payment @@ -0,0 +1 @@ +../../../../account_ebics_batch_payment \ No newline at end of file diff --git a/setup/account_ebics_batch_payment/setup.py b/setup/account_ebics_batch_payment/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/account_ebics_batch_payment/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)