Skip to content

Commit

Permalink
[ADD]account_statement_import_online_plaid
Browse files Browse the repository at this point in the history
  • Loading branch information
adasatorres committed May 23, 2024
1 parent 3c361ef commit 7976fe8
Show file tree
Hide file tree
Showing 20 changed files with 645 additions and 582 deletions.
58 changes: 58 additions & 0 deletions account_statement_import_online_plaid/README.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
<<<<<<< HEAD
===================================
Online Bank Statements: MyPonto.com
===================================
=======
=================================
Online Bank Statements: plaid.com
=================================
>>>>>>> 1fb54cfa7278074ebc9b13dd53949a091d63649b

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<<<<<<< HEAD
!! source digest: sha256:4761a86432e267dd6dc91976fd25d4ea5ae91d06c8f1bf8a50c24c1916268d8e
=======
!! source digest: sha256:eae90c428d067a075f689f072048c92aca4b799ca86b9318e0c53f6e74063763
>>>>>>> 1fb54cfa7278074ebc9b13dd53949a091d63649b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -17,18 +27,29 @@ Online Bank Statements: MyPonto.com
: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
<<<<<<< HEAD
:target: https://github.com/OCA/bank-statement-import/tree/16.0/account_statement_import_online_ponto
: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-16-0/bank-statement-import-16-0-account_statement_import_online_ponto
=======
:target: https://github.com/OCA/bank-statement-import/tree/16.0/account_statement_import_online_plaid
: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-16-0/bank-statement-import-16-0-account_statement_import_online_plaid
>>>>>>> 1fb54cfa7278074ebc9b13dd53949a091d63649b
: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=16.0
:alt: Try me on Runboat

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

<<<<<<< HEAD
This module provides online bank statements from MyPonto.com.
=======
This module provides online bank statements from Plaid.com.
>>>>>>> 1fb54cfa7278074ebc9b13dd53949a091d63649b

**Table of contents**

Expand All @@ -43,7 +64,11 @@ To configure online bank statements provider:
#. Go to *Invoicing > Configuration > Bank Accounts*
#. Open bank account to configure and edit it
#. Set *Bank Feeds* to *Online*
<<<<<<< HEAD
#. Select *MyPonto.com* as online bank statements provider in
=======
#. Select *Plaid.com* as online bank statements provider in
>>>>>>> 1fb54cfa7278074ebc9b13dd53949a091d63649b
*Online Bank Statements (OCA)* section
#. Save the bank account
#. Click on provider and configure provider-specific settings.
Expand All @@ -54,14 +79,22 @@ or, alternatively:
#. Open settings of the corresponding journal account
#. Switch to *Bank Account* tab
#. Set *Bank Feeds* to *Online*
<<<<<<< HEAD
#. Select *MyPonto.com* as online bank statements provider in
=======
#. Select *Plaid.com* as online bank statements provider in
>>>>>>> 1fb54cfa7278074ebc9b13dd53949a091d63649b
*Online Bank Statements (OCA)* section
#. Save the bank account
#. Click on provider and configure provider-specific settings.

To obtain *Login* and *Key*:

<<<<<<< HEAD
#. Open `MyPonto.com <https://myponto.com/>`_.
=======
#. Open `Plaid.com <https://plaid.com/>`_.
>>>>>>> 1fb54cfa7278074ebc9b13dd53949a091d63649b

Check also ``account_bank_statement_import_online`` configuration instructions
for more information.
Expand All @@ -73,7 +106,14 @@ To pull historical bank statements:

#. Go to *Invoicing > Configuration > Bank Accounts*
#. Select specific bank accounts
<<<<<<< HEAD
#. Launch *Actions > Online Bank Statements Pull Wizard*
=======
#. Configure username, password and host for plaid
#. Launch *Actions > Sync with plaid.com*

#. After launch *Actions > Online Bank Statements Pull Wizard*
>>>>>>> 1fb54cfa7278074ebc9b13dd53949a091d63649b
#. Configure date interval and click *Pull*

If historical data is not needed, then just simply wait for the scheduled
Expand All @@ -86,7 +126,11 @@ 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
<<<<<<< HEAD
`feedback <https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_statement_import_online_ponto%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
=======
`feedback <https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_statement_import_online_plaid%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
>>>>>>> 1fb54cfa7278074ebc9b13dd53949a091d63649b

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

Expand All @@ -96,12 +140,17 @@ Credits
Authors
~~~~~~~

<<<<<<< HEAD
* Florent de Labarre
* Therp BV
=======
* Binhex
>>>>>>> 1fb54cfa7278074ebc9b13dd53949a091d63649b

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

<<<<<<< HEAD
* Florent de Labarre
* `Tecnativa <https://www.tecnativa.com>`__:

Expand All @@ -110,6 +159,11 @@ Contributors
* `Therp BV <https://therp.nl>`__:

* Ronald Portier <ronald@therp.nl>
=======
* `Binhex <https://binhex.cloud>`_:

* Adasat Torres de León <a.torres@binhex.cloud>
>>>>>>> 1fb54cfa7278074ebc9b13dd53949a091d63649b

Maintainers
~~~~~~~~~~~
Expand All @@ -124,6 +178,10 @@ 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.

<<<<<<< HEAD
This module is part of the `OCA/bank-statement-import <https://github.com/OCA/bank-statement-import/tree/16.0/account_statement_import_online_ponto>`_ project on GitHub.
=======
This module is part of the `OCA/bank-statement-import <https://github.com/OCA/bank-statement-import/tree/16.0/account_statement_import_online_plaid>`_ project on GitHub.
>>>>>>> 1fb54cfa7278074ebc9b13dd53949a091d63649b

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
17 changes: 8 additions & 9 deletions account_statement_import_online_plaid/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Binhex - Adasat Torres de León.
# Copyright 2024 Binhex - Adasat Torres de León.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Online Bank Statements: plaid.com",
Expand All @@ -12,14 +12,13 @@
"data": [
"views/online_bank_statement_provider.xml",
],
'assets': {
'web.assets_backend': [
'https://cdn.plaid.com/link/v2/stable/link-initialize.js',
'https://cdn.plaid.com/',
'account_statement_import_online_plaid/static/src/**/**.js',
"assets": {
"web.assets_backend": [
"/account_statement_import_online_plaid/static/src/**/*.js",
"https://cdn.plaid.com/link/v2/stable/link-initialize.js",
],
},
'external_dependencies': {
'python': ['plaid-python'],
}
"external_dependencies": {
"python": ["plaid-python"],
},
}
102 changes: 102 additions & 0 deletions account_statement_import_online_plaid/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_statement_import_online_plaid
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0-20240104\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-22 12:02+0000\n"
"PO-Revision-Date: 2024-05-22 13:04+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.4.3\n"

#. module: account_statement_import_online_plaid
#: model:ir.model.fields.selection,name:account_statement_import_online_plaid.selection__online_bank_statement_provider__plaid_host__development
msgid "Development"
msgstr "Desarrollo"

#. module: account_statement_import_online_plaid
#. odoo-python
#: code:addons/account_statement_import_online_plaid/models/plaid_interface.py:0
#, python-format
msgid "Error getting access token: %s"
msgstr "Error al obtener el token de acceso: %s"

#. module: account_statement_import_online_plaid
#. odoo-python
#: code:addons/account_statement_import_online_plaid/models/plaid_interface.py:0
#, python-format
msgid "Error getting client api: %s"
msgstr "Error obteniendo api de cliente: %s"

#. module: account_statement_import_online_plaid
#. odoo-python
#: code:addons/account_statement_import_online_plaid/models/plaid_interface.py:0
#, python-format
msgid "Error getting link token: %s"
msgstr "Error al obtener el token de enlace: %s"

#. module: account_statement_import_online_plaid
#. odoo-python
#: code:addons/account_statement_import_online_plaid/models/plaid_interface.py:0
#, python-format
msgid "Error getting transactions: %s"
msgstr "Error al obtener transacciones: %s"

#. module: account_statement_import_online_plaid
#: model_terms:ir.ui.view,arch_db:account_statement_import_online_plaid.online_bank_statement_provider_form
msgid "Login"
msgstr "Iniciar sesión"

#. module: account_statement_import_online_plaid
#: model:ir.model,name:account_statement_import_online_plaid.model_online_bank_statement_provider
msgid "Online Bank Statement Provider"
msgstr "Proveedor de extractos bancarios en línea"

#. module: account_statement_import_online_plaid
#: model:ir.model.fields,field_description:account_statement_import_online_plaid.field_online_bank_statement_provider__plaid_access_token
msgid "Plaid Access Token"
msgstr "Ficha de acceso Plaid"

#. module: account_statement_import_online_plaid
#: model:ir.model.fields,field_description:account_statement_import_online_plaid.field_online_bank_statement_provider__plaid_host
#: model_terms:ir.ui.view,arch_db:account_statement_import_online_plaid.online_bank_statement_provider_form
msgid "Plaid Host"
msgstr "Anfitrión"

#. module: account_statement_import_online_plaid
#: model:ir.model,name:account_statement_import_online_plaid.model_plaid_interface
msgid "Plaid Interface"
msgstr "Interfaz plaid"

#. module: account_statement_import_online_plaid
#: model_terms:ir.ui.view,arch_db:account_statement_import_online_plaid.online_bank_statement_provider_form
msgid "Plaid config"
msgstr "Configuración plaid"

#. module: account_statement_import_online_plaid
#: model:ir.model.fields.selection,name:account_statement_import_online_plaid.selection__online_bank_statement_provider__plaid_host__production
msgid "Production"
msgstr "Producción"

#. module: account_statement_import_online_plaid
#: model:ir.model.fields.selection,name:account_statement_import_online_plaid.selection__online_bank_statement_provider__plaid_host__sandbox
msgid "Sandbox"
msgstr "Salvadera"

#. module: account_statement_import_online_plaid
#: model_terms:ir.ui.view,arch_db:account_statement_import_online_plaid.online_bank_statement_provider_form
msgid "Secret Key"
msgstr "LLave secreta"

#. module: account_statement_import_online_plaid
#: model_terms:ir.ui.view,arch_db:account_statement_import_online_plaid.online_bank_statement_provider_form
msgid "Sync with Plaid.com"
msgstr "Sincronizar con plaid.com"
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Copyright 2024 Binhex - Adasat Torres de León.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import logging
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError

_logger = logging.getLogger(__name__)
from odoo import api, fields, models


class OnlineBankStatementProvider(models.Model):
Expand All @@ -27,15 +23,15 @@ def _obtain_statement_data(self, date_since, date_until):

@api.model
def _get_available_services(self):
"""Each provider model must register its service."""
return super()._get_available_services() + [
("plaid", "Plaid.com"),
]

def action_sync_with_plaid(self):
self.ensure_one()
plaid_interface = self.env["plaid.interface"]
client = plaid_interface._client(self.username, self.password, self.plaid_host)
args = [self.username, self.password, self.plaid_host]
client = plaid_interface._client(*args)
plaid_link_token = plaid_interface._link(client)
return {
"type": "ir.actions.client",
Expand All @@ -45,11 +41,11 @@ def action_sync_with_plaid(self):

def _plaid_retrieve_data(self, date_since, date_until):
plaid_interface = self.env["plaid.interface"]
client = plaid_interface._client(self.username, self.password, self.plaid_host)
args = [self.username, self.password, self.plaid_host]
client = plaid_interface._client(*args)
transactions = plaid_interface._get_transactions(
client, self.plaid_access_token, date_since, date_until
)
_logger.info(transactions)
return self._prepare_vals_for_statement(transactions)

def plaid_create_access_token(self, public_token, active_id):
Expand All @@ -58,7 +54,8 @@ def plaid_create_access_token(self, public_token, active_id):
client = plaid_interface._client(

Check warning on line 54 in account_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py

View check run for this annotation

Codecov / codecov/patch

account_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py#L52-L54

Added lines #L52 - L54 were not covered by tests
provider.username, provider.password, provider.plaid_host
)
provider.plaid_access_token = plaid_interface._login(client, public_token)
args = [client, public_token]
provider.plaid_access_token = plaid_interface._login(*args)

Check warning on line 58 in account_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py

View check run for this annotation

Codecov / codecov/patch

account_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py#L57-L58

Added lines #L57 - L58 were not covered by tests
if provider.plaid_access_token:
return True
return False

Check warning on line 61 in account_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py

View check run for this annotation

Codecov / codecov/patch

account_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py#L60-L61

Added lines #L60 - L61 were not covered by tests
Expand Down
Loading

0 comments on commit 7976fe8

Please sign in to comment.