mirror of
https://github.com/brain-tec/account_ebics.git
synced 2024-12-25 02:41:44 +00:00
Merge branch '17.0-mig-account_ebics_payment_order' into '17.0'
[MIG] account ebics payment order: Migration to 17.0 See merge request Noviat/Noviat_Generic/accounting-ebics!35
This commit is contained in:
commit
576f0da6be
24
account_ebics_payment_order/README.rst
Normal file
24
account_ebics_payment_order/README.rst
Normal 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 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.
|
||||
|
1
account_ebics_payment_order/__init__.py
Normal file
1
account_ebics_payment_order/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from . import models
|
17
account_ebics_payment_order/__manifest__.py
Normal file
17
account_ebics_payment_order/__manifest__.py
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright 2009-2024 Noviat.
|
||||
# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl).
|
||||
|
||||
{
|
||||
"name": "Upload Payment Order 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_payment_order"],
|
||||
"data": [
|
||||
"views/account_payment_order_views.xml",
|
||||
],
|
||||
"images": ["static/description/cover.png"],
|
||||
"installable": True,
|
||||
}
|
1
account_ebics_payment_order/models/__init__.py
Normal file
1
account_ebics_payment_order/models/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from . import account_payment_order
|
74
account_ebics_payment_order/models/account_payment_order.py
Normal file
74
account_ebics_payment_order/models/account_payment_order.py
Normal file
@ -0,0 +1,74 @@
|
||||
# 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 AccountPaymentOrder(models.Model):
|
||||
_inherit = "account.payment.order"
|
||||
|
||||
def ebics_upload(self):
|
||||
self.ensure_one()
|
||||
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
|
||||
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."
|
||||
)
|
||||
)
|
||||
ctx = self.env.context.copy()
|
||||
if len(ebics_config) == 1:
|
||||
ctx["default_ebics_config_id"] = ebics_config.id
|
||||
ctx.update(
|
||||
{
|
||||
"default_upload_data": attach.datas,
|
||||
"default_upload_fname": attach.name,
|
||||
"origin": origin,
|
||||
"force_comany": self.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
|
3
account_ebics_payment_order/pyproject.toml
Normal file
3
account_ebics_payment_order/pyproject.toml
Normal file
@ -0,0 +1,3 @@
|
||||
[build-system]
|
||||
requires = ["whool"]
|
||||
build-backend = "whool.buildapi"
|
BIN
account_ebics_payment_order/static/description/cover.png
Normal file
BIN
account_ebics_payment_order/static/description/cover.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
BIN
account_ebics_payment_order/static/description/icon.png
Normal file
BIN
account_ebics_payment_order/static/description/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="account_payment_order_form" model="ir.ui.view">
|
||||
<field name="name">account.payment.order.form</field>
|
||||
<field name="model">account.payment.order</field>
|
||||
<field name="inherit_id" ref="account_payment_order.account_payment_order_form" />
|
||||
<field name="arch" type="xml">
|
||||
<button name="open2generated" position="after">
|
||||
<button
|
||||
name="ebics_upload"
|
||||
type="object"
|
||||
invisible="state != 'generated'"
|
||||
string="EBICS Upload"
|
||||
class="oe_highlight"
|
||||
/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
Loading…
Reference in New Issue
Block a user