diff --git a/account_ebics_payment_order/README.rst b/account_ebics_payment_order/README.rst new file mode 100644 index 0000000..e976663 --- /dev/null +++ b/account_ebics_payment_order/README.rst @@ -0,0 +1,28 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +============================== +Upload Payment Order via EBICS +============================== + +This module allows to upload a Payment Order to the bank via the EBICS protocol. + +Installation +============ + +This module depends upon the following modules (cf. apps.odoo.com): + +- account_ebics +- account_payment_order + +Usage +===== + +Create your Payment Order and generate the bank file. +Upload the generated file via the 'EBICS Upload' button on the payment order. + +Known issues / Roadmap +====================== + + * Add support for multiple EBICS connections. diff --git a/account_ebics_payment_order/__init__.py b/account_ebics_payment_order/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/account_ebics_payment_order/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/account_ebics_payment_order/__manifest__.py b/account_ebics_payment_order/__manifest__.py new file mode 100644 index 0000000..fc438c4 --- /dev/null +++ b/account_ebics_payment_order/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2009-2019 Noviat. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Upload Payment Order via EBICS', + 'version': '11.0.1.0.0', + 'license': 'AGPL-3', + 'author': 'Noviat', + 'category': 'Accounting & Finance', + 'depends': [ + 'account_ebics', + 'account_payment_order'], + 'data': [ + 'views/account_payment_order.xml', + ], + 'installable': True, +} diff --git a/account_ebics_payment_order/models/__init__.py b/account_ebics_payment_order/models/__init__.py new file mode 100644 index 0000000..429f032 --- /dev/null +++ b/account_ebics_payment_order/models/__init__.py @@ -0,0 +1 @@ +from . import account_payment_order diff --git a/account_ebics_payment_order/models/account_payment_order.py b/account_ebics_payment_order/models/account_payment_order.py new file mode 100644 index 0000000..750b3a6 --- /dev/null +++ b/account_ebics_payment_order/models/account_payment_order.py @@ -0,0 +1,50 @@ +# Copyright 2009-2019 Noviat. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, models, _ +from odoo.exceptions import UserError + + +class AccountPaymentOrder(models.Model): + _inherit = 'account.payment.order' + + @api.multi + def ebics_upload(self): + self.ensure_one() + ctx = self._context.copy() + attach = self.env['ir.attachment'].search( + [('res_model', '=', self._name), + ('res_id', '=', self.id)]) + if not attach: + raise UserError(_( + "This payment order doesn't contains attachements." + "\nPlease generate first the Payment Order file first.")) + elif len(attach) > 1: + raise UserError(_( + "This payment order contains multiple attachments." + "\nPlease remove the obsolete attachments or upload " + "the payment order file via the " + "EBICS Processing > EBICS Upload menu")) + else: + origin = _("Payment Order") + ': ' + self.name + ctx.update({ + 'default_upload_data': attach.datas, + 'default_upload_fname': attach.datas_fname, + 'origin': origin, + }) + ebics_xfer = self.env['ebics.xfer'].with_context(ctx).create({}) + 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_payment_order/static/description/icon.png b/account_ebics_payment_order/static/description/icon.png new file mode 100644 index 0000000..889d129 Binary files /dev/null and b/account_ebics_payment_order/static/description/icon.png differ diff --git a/account_ebics_payment_order/views/account_payment_order.xml b/account_ebics_payment_order/views/account_payment_order.xml new file mode 100644 index 0000000..9bd43c8 --- /dev/null +++ b/account_ebics_payment_order/views/account_payment_order.xml @@ -0,0 +1,18 @@ + + + + + + account.payment.order.form + account.payment.order + + + + + + + +