Merge branch '17.0-mig-account_ebics_batch_payment' into '17.0'

[MIG] account_ebics_batch_payment: Migration to 17.0

See merge request Noviat/Noviat_Generic/accounting-ebics!31
This commit is contained in:
Luc De Meyer 2024-01-31 20:58:58 +00:00
commit 41c14ec451
9 changed files with 117 additions and 0 deletions

View File

@ -0,0 +1,24 @@
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg
:target: https://www.gnu.org/licenses/lgpl
: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.

View File

@ -0,0 +1 @@
from . import models

View File

@ -0,0 +1,15 @@
# Copyright 2009-2024 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl).
{
"name": "Upload Batch Payment via EBICS",
"version": "17.0.1.0.0",
"license": "LGPL-3",
"author": "Noviat",
"website": "https://www.noviat.com",
"category": "Accounting & Finance",
"depends": ["account_ebics", "account_batch_payment"],
"data": ["views/account_batch_payment_views.xml"],
"installable": True,
"images": ["static/description/cover.png"],
}

View File

@ -0,0 +1 @@
from . import account_batch_payment

View File

@ -0,0 +1,53 @@
# Copyright 2009-2023 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl).
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

View File

@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_batch_payment_form" model="ir.ui.view">
<field name="name">account.batch.payment.form</field>
<field name="model">account.batch.payment</field>
<field name="inherit_id" ref="account_batch_payment.view_batch_payment_form" />
<field name="arch" type="xml">
<button name="validate_batch_button" position="after">
<button
name="ebics_upload"
type="object"
invisible="not file_generation_enabled or state != 'sent'"
string="EBICS Upload"
/>
</button>
</field>
</record>
</odoo>