Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing from upstream OCA/bank-statement-import (14.0) #521

Merged
merged 7 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ addon | version | maintainers | summary
[account_statement_import_online_ponto_ing](account_statement_import_online_ponto_ing/) | 14.0.1.0.0 | | Online Bank Statements: MyPonto.com ING customization
[account_statement_import_online_wise](account_statement_import_online_wise/) | 14.0.1.0.0 | [![alexey-pelykh](https://github.com/alexey-pelykh.png?size=30px)](https://github.com/alexey-pelykh) | Online bank statements for Wise.com (TransferWise.com)
[account_statement_import_paypal](account_statement_import_paypal/) | 14.0.1.0.1 | | Import PayPal CSV files as Bank Statements in Odoo
[account_statement_import_sftp](account_statement_import_sftp/) | 14.0.1.0.0 | [![OCA](https://github.com/OCA.png?size=30px)](https://github.com/OCA) | Import bank statement from an SFTP server
[account_statement_import_txt_xlsx](account_statement_import_txt_xlsx/) | 14.0.3.1.0 | [![alexey-pelykh](https://github.com/alexey-pelykh.png?size=30px)](https://github.com/alexey-pelykh) | Import TXT/CSV or XLSX files as Bank Statements in Odoo

[//]: # (end addons)
Expand Down
97 changes: 97 additions & 0 deletions account_statement_import_sftp/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
==========================
Bank Statement SFTP import
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a233d1b8df4a5f6eaa2659633fdbca0baa05ecfa235053e18c2b5a29dd985ce9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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-OCA%2Fbank--statement--import-lightgray.png?logo=github
:target: https://github.com/OCA/bank-statement-import/tree/14.0/account_statement_import_sftp
:alt: OCA/bank-statement-import
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/bank-statement-import-14-0/bank-statement-import-14-0-account_statement_import_sftp
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/bank-statement-import&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

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.

To post the statement at import create a config parameter import_statement_edi_auto_post with True as value

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-statement-import/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 <https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_statement_import_sftp%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Compassion CH

Contributors
~~~~~~~~~~~~

* Simon Gonzalez <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-OCA| image:: https://github.com/OCA.png?size=40px
:target: https://github.com/OCA
:alt: OCA

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-OCA|

This module is part of the `OCA/bank-statement-import <https://github.com/OCA/bank-statement-import/tree/14.0/account_statement_import_sftp>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions account_statement_import_sftp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import components
24 changes: 24 additions & 0 deletions account_statement_import_sftp/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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",
],
}
1 change: 1 addition & 0 deletions account_statement_import_sftp/components/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_statement_import_process
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2023 Compassion CH
# @author: Simon Gonzalez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _
from odoo.tools import str2bool

from odoo.addons.component.core import Component


class EdiBankStatementImportProcess(Component):
_name = "edi.input.process.bank.statement.import"
_usage = "input.process"
_backend_type = "bk_sftp_imp"
_inherit = "edi.component.input.mixin"

def process(self):
ir_config = self.env["ir.config_parameter"].sudo()
auto_post = str2bool(ir_config.get_param("import_statement_edi_auto_post"))
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."))
if auto_post:
statement.button_post()
7 changes: 7 additions & 0 deletions account_statement_import_sftp/data/edi_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="sftp_bank_edi" model="edi.backend.type">
<field name="name">Bank SFTP Import</field>
<field name="code">bk_sftp_imp</field>
</record>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_statement_import_sftp
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: account_statement_import_sftp
#: code:addons/account_statement_import_sftp/components/account_statement_import_process.py:0
#, python-format
msgid "The bank statement could not be validated."
msgstr ""

#. module: account_statement_import_sftp
#: code:addons/account_statement_import_sftp/components/account_statement_import_process.py:0
#, python-format
msgid "The import didn't succeed."
msgstr ""
1 change: 1 addition & 0 deletions account_statement_import_sftp/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
To configure you should configure an EDI Backend with the backend type *Bank SFTP*
1 change: 1 addition & 0 deletions account_statement_import_sftp/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Simon Gonzalez <[email protected]>
1 change: 1 addition & 0 deletions account_statement_import_sftp/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module add the functionality to automatically import into bank statement the files retrieved from SFTP.
Empty file.
4 changes: 4 additions & 0 deletions account_statement_import_sftp/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
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.

To post the statement at import create a config parameter import_statement_edi_auto_post with True as value
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading