diff --git a/account_statement_import_sftp/README.rst b/account_statement_import_sftp/README.rst new file mode 100644 index 00000000..0a112864 --- /dev/null +++ b/account_statement_import_sftp/README.rst @@ -0,0 +1,80 @@ +========================== +Bank Statement SFTP import +========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:5c3cf1f51472f25338373320dc7fb418546e2fa8d4de688e6f32a1c937267b6a + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-CompassionCH%2Fbank--statement--import-lightgray.png?logo=github + :target: https://github.com/CompassionCH/bank-statement-import/tree/14.0/account_statement_import_sftp + :alt: CompassionCH/bank-statement-import + +|badge1| |badge2| |badge3| + +This module add the functionality to automatically import into bank statement the files retrieved from SFTP. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure you should configure an EDI Backend with the backend type *Bank SFTP* + +Usage +===== + +To use this module you should configure an exchange type and a backend SFTP. +Then when the scheduled action of EDI will run you will get your statement imported automatically. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Compassion CH + +Contributors +~~~~~~~~~~~~ + +* Compassion CH (https://www.compassion.ch) + * Simon Gonzalez + +Maintainers +~~~~~~~~~~~ + +.. |maintainer-OCA| image:: https://github.com/OCA.png?size=40px + :target: https://github.com/OCA + :alt: OCA + +Current maintainer: + +|maintainer-OCA| + +This module is part of the `CompassionCH/bank-statement-import `_ project on GitHub. + +You are welcome to contribute. diff --git a/account_statement_import_sftp/__init__.py b/account_statement_import_sftp/__init__.py new file mode 100644 index 00000000..1377f57f --- /dev/null +++ b/account_statement_import_sftp/__init__.py @@ -0,0 +1 @@ +from . import components diff --git a/account_statement_import_sftp/__manifest__.py b/account_statement_import_sftp/__manifest__.py new file mode 100644 index 00000000..97545ced --- /dev/null +++ b/account_statement_import_sftp/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2019 ForgeFlow, S.L. +# Copyright 2020 CorporateHub (https://corporatehub.eu) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Bank Statement SFTP import", + "summary": "Import bank statement from an SFTP server", + "version": "14.0.1.0.0", + "category": "Accounting", + "website": "https://github.com/OCA/bank-statement-import", + "author": "Odoo Community Association (OCA), Compassion CH", + "maintainers": ["OCA"], + "license": "AGPL-3", + "installable": True, + "depends": [ + "edi_storage_oca", # OCA/edi + "storage_backend_sftp", # OCA/storage + "account_statement_import", + "base_automation", + ], + "data": [ + "data/edi_data.xml", + ], +} diff --git a/account_statement_import_sftp/components/__init__.py b/account_statement_import_sftp/components/__init__.py new file mode 100644 index 00000000..cf2eb057 --- /dev/null +++ b/account_statement_import_sftp/components/__init__.py @@ -0,0 +1 @@ +from . import account_statement_import_process diff --git a/account_statement_import_sftp/components/account_statement_import_process.py b/account_statement_import_sftp/components/account_statement_import_process.py new file mode 100644 index 00000000..5db7f2ce --- /dev/null +++ b/account_statement_import_sftp/components/account_statement_import_process.py @@ -0,0 +1,29 @@ +# Copyright 2023 Compassion CH +# @author: Simon Gonzalez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import _ + +from odoo.addons.component.core import Component + + +class EdiBankStatementImportProcess(Component): + _name = "edi.input.process.bank.statement.import" + _usage = "input.process" + _backend_type = "bk_sftp" + _inherit = "edi.component.input.mixin" + + def process(self): + statement_import = self.env["account.statement.import"].create( + [ + { + "statement_file": self.exchange_record.exchange_file, + "statement_filename": self.exchange_record.exchange_filename, + } + ] + ) + action = statement_import.import_file_button() + if not action: + raise ValueError(_("The import didn't succeed.")) + statement = self.env["account.bank.statement"].browse(action.get("res_id")) + if not (statement.state and statement.state in ["posted", "open"]): + raise ValueError(_("The bank statement could not be validated.")) diff --git a/account_statement_import_sftp/data/edi_data.xml b/account_statement_import_sftp/data/edi_data.xml new file mode 100644 index 00000000..f0b122a3 --- /dev/null +++ b/account_statement_import_sftp/data/edi_data.xml @@ -0,0 +1,7 @@ + + + + Bank SFTP Import + bk_sftp_imp + + diff --git a/account_statement_import_sftp/readme/CONFIGURE.rst b/account_statement_import_sftp/readme/CONFIGURE.rst new file mode 100644 index 00000000..593072ce --- /dev/null +++ b/account_statement_import_sftp/readme/CONFIGURE.rst @@ -0,0 +1 @@ +To configure you should configure an EDI Backend with the backend type *Bank SFTP* diff --git a/account_statement_import_sftp/readme/CONTRIBUTORS.rst b/account_statement_import_sftp/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..3ac5359f --- /dev/null +++ b/account_statement_import_sftp/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Simon Gonzalez diff --git a/account_statement_import_sftp/readme/DESCRIPTION.rst b/account_statement_import_sftp/readme/DESCRIPTION.rst new file mode 100644 index 00000000..eba19370 --- /dev/null +++ b/account_statement_import_sftp/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module add the functionality to automatically import into bank statement the files retrieved from SFTP. diff --git a/account_statement_import_sftp/readme/HISTORY.rst b/account_statement_import_sftp/readme/HISTORY.rst new file mode 100644 index 00000000..e69de29b diff --git a/account_statement_import_sftp/readme/USAGE.rst b/account_statement_import_sftp/readme/USAGE.rst new file mode 100644 index 00000000..a2aba212 --- /dev/null +++ b/account_statement_import_sftp/readme/USAGE.rst @@ -0,0 +1,2 @@ +To use this module you should configure an exchange type and a backend SFTP. +Then when the scheduled action of EDI will run you will get your statement imported automatically. diff --git a/account_statement_import_sftp/static/description/index.html b/account_statement_import_sftp/static/description/index.html new file mode 100644 index 00000000..1402e324 --- /dev/null +++ b/account_statement_import_sftp/static/description/index.html @@ -0,0 +1,430 @@ + + + + + + +Bank Statement SFTP import + + + +
+

Bank Statement SFTP import

+ + +

Beta License: AGPL-3 CompassionCH/bank-statement-import

+

This module add the functionality to automatically import into bank statement the files retrieved from SFTP.

+

Table of contents

+ +
+

Configuration

+

To configure you should configure an EDI Backend with the backend type Bank SFTP

+
+
+

Usage

+

To use this module you should configure an exchange type and a backend SFTP. +Then when the scheduled action of EDI will run you will get your statement imported automatically.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Compassion CH
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

Current maintainer:

+

OCA

+

This module is part of the CompassionCH/bank-statement-import project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/oca_dependencies.txt b/oca_dependencies.txt index 21b71834..c55a227e 100644 --- a/oca_dependencies.txt +++ b/oca_dependencies.txt @@ -1,2 +1,4 @@ # See https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#oca_dependencies-txt web +edi +storage diff --git a/setup/account_statement_import_sftp/odoo/addons/account_statement_import_sftp b/setup/account_statement_import_sftp/odoo/addons/account_statement_import_sftp new file mode 120000 index 00000000..efd06767 --- /dev/null +++ b/setup/account_statement_import_sftp/odoo/addons/account_statement_import_sftp @@ -0,0 +1 @@ +../../../../account_statement_import_sftp \ No newline at end of file diff --git a/setup/account_statement_import_sftp/setup.py b/setup/account_statement_import_sftp/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/account_statement_import_sftp/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)