diff --git a/account_ebics_oe_statement_import/README.rst b/account_ebics_oe_statement_import/README.rst new file mode 100644 index 0000000..322501f --- /dev/null +++ b/account_ebics_oe_statement_import/README.rst @@ -0,0 +1,17 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-blue.png + :target: https://www.gnu.org/licenses/lgpl + :alt: License: LGPL-3 + +====================================================================== +Deploy account_ebics module with Odoo Enterprise Bank Statement Import +====================================================================== + +This module makes it possible to use Odoo Enterprise account_bank_statement_import +in combination with 'account_ebics'. + +This module will be installed automatically when following modules are activated +on your odoo database : + +- account_ebics_oe +- account_bank_statement_import + diff --git a/account_ebics_oe_statement_import/__init__.py b/account_ebics_oe_statement_import/__init__.py new file mode 100644 index 0000000..5cb1c49 --- /dev/null +++ b/account_ebics_oe_statement_import/__init__.py @@ -0,0 +1 @@ +from . import wizards diff --git a/account_ebics_oe_statement_import/__manifest__.py b/account_ebics_oe_statement_import/__manifest__.py new file mode 100644 index 0000000..12c2eda --- /dev/null +++ b/account_ebics_oe_statement_import/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2020-2022 Noviat. +# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl). + +{ + "name": "account_ebics with Odoo Enterprise Bank Statement Import", + "summary": "Use Odoo Enterprise Bank Statement Import with account_ebics", + "version": "15.0.1.0.0", + "author": "Noviat", + "website": "https://www.noviat.com", + "category": "Hidden", + "license": "LGPL-3", + "depends": [ + "account_ebics_oe", + "account_bank_statement_import", + ], + "installable": True, + "auto_install": True, +} diff --git a/account_ebics_oe_statement_import/static/description/icon.png b/account_ebics_oe_statement_import/static/description/icon.png new file mode 100644 index 0000000..889d129 Binary files /dev/null and b/account_ebics_oe_statement_import/static/description/icon.png differ diff --git a/account_ebics_oe_statement_import/wizards/__init__.py b/account_ebics_oe_statement_import/wizards/__init__.py new file mode 100644 index 0000000..7dafcd1 --- /dev/null +++ b/account_ebics_oe_statement_import/wizards/__init__.py @@ -0,0 +1 @@ +from . import account_bank_statement_import diff --git a/account_ebics_oe_statement_import/wizards/account_bank_statement_import.py b/account_ebics_oe_statement_import/wizards/account_bank_statement_import.py new file mode 100644 index 0000000..03324a6 --- /dev/null +++ b/account_ebics_oe_statement_import/wizards/account_bank_statement_import.py @@ -0,0 +1,60 @@ +# Copyright 2009-2020 Noviat. +# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl). + +import logging + +from odoo import _, models + +_logger = logging.getLogger(__name__) + + +class AccountBankStatementImport(models.TransientModel): + _inherit = "account.bank.statement.import" + + def _check_parsed_data(self, stmts_vals, account_number): + """Basic and structural verifications""" + if self.env.context.get("active_model") == "ebics.file": + message = False + if len(stmts_vals) == 0: + message = _("This file doesn't contain any statement.") + if not message: + no_st_line = True + for vals in stmts_vals: + if vals["transactions"] and len(vals["transactions"]) > 0: + no_st_line = False + break + if no_st_line: + message = _("This file doesn't contain any transaction.") + if message: + log_msg = ( + _("Error detected while processing and EBICS File") + + ":\n" + + message + ) + _logger.warn(log_msg) + return + super()._check_parsed_data(stmts_vals, account_number) + + def _create_bank_statements(self, stmts_vals): + """ + Return error message to ebics.file when handling empty camt. + + Remarks/TODO: + We could add more info to the message (e.g. date, balance, ...) + and write this to the ebics.file, note field. + We could also create empty bank statement (in state done) to clearly + show days without transactions via the bank statement list view. + """ + if self.env.context.get("active_model") == "ebics.file": + transactions = False + for st_vals in stmts_vals: + if st_vals.get("transactions"): + transactions = True + break + if not transactions: + message = _("This file doesn't contain any transaction.") + st_line_ids = [] + notifications = {"type": "warning", "message": message, "details": ""} + return st_line_ids, [notifications] + + return super()._create_bank_statements(stmts_vals) diff --git a/setup/account_ebics_oe_statement_import/odoo/addons/account_ebics_oe_statement_import b/setup/account_ebics_oe_statement_import/odoo/addons/account_ebics_oe_statement_import new file mode 120000 index 0000000..75aca1f --- /dev/null +++ b/setup/account_ebics_oe_statement_import/odoo/addons/account_ebics_oe_statement_import @@ -0,0 +1 @@ +../../../../account_ebics_oe_statement_import \ No newline at end of file diff --git a/setup/account_ebics_oe_statement_import/setup.py b/setup/account_ebics_oe_statement_import/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/account_ebics_oe_statement_import/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)