-
-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
================================= | ||
Online Bank Statements: plaid.com | ||
================================= | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:a7b84e04274ce7746346dbb4b33c1d2d98df5306dfde3a173ce2982576104eae | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/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 | ||
: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| | ||
|
||
This module provides online bank statements from Plaid.com. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
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* | ||
#. Select *Plaid.com* as online bank statements provider in | ||
*Online Bank Statements (OCA)* section | ||
#. Save the bank account | ||
#. Click on provider and configure provider-specific settings. | ||
|
||
or, alternatively: | ||
|
||
#. Go to *Invoicing > Overview* | ||
#. Open settings of the corresponding journal account | ||
#. Switch to *Bank Account* tab | ||
#. Set *Bank Feeds* to *Online* | ||
#. Select *Plaid.com* as online bank statements provider in | ||
*Online Bank Statements (OCA)* section | ||
#. Save the bank account | ||
#. Click on provider and configure provider-specific settings. | ||
|
||
To obtain *Login* and *Key*: | ||
|
||
#. Open `Plaid.com <https://plaid.com/>`_. | ||
|
||
Check also ``account_bank_statement_import_online`` configuration instructions | ||
for more information. | ||
|
||
Usage | ||
===== | ||
|
||
To pull historical bank statements: | ||
|
||
#. Go to *Invoicing > Configuration > Bank Accounts* | ||
#. Select specific bank accounts | ||
#. Configure username, password and host for plaid | ||
#. Launch *Actions > Sync with plaid.com* | ||
|
||
#. After launch *Actions > Online Bank Statements Pull Wizard* | ||
#. Configure date interval and click *Pull* | ||
|
||
If historical data is not needed, then just simply wait for the scheduled | ||
activity "Pull Online Bank Statements" to be executed for getting new | ||
transactions. | ||
|
||
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_online_plaid%0Aversion:%2016.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 | ||
~~~~~~~ | ||
|
||
* Binhex | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Binhex <https://binhex.cloud>`_: | ||
|
||
* Adasat Torres de León <[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. | ||
|
||
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. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 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", | ||
"version": "16.0.1.0.0", | ||
"category": "Account", | ||
"website": "https://github.com/OCA/bank-statement-import", | ||
"author": "Binhex, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"installable": True, | ||
"depends": ["account_statement_import_online"], | ||
"data": [ | ||
"views/online_bank_statement_provider.xml", | ||
], | ||
"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"], | ||
}, | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from . import online_bank_statement_provider_plaid | ||
from . import plaid_interface |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Copyright 2024 Binhex - Adasat Torres de León. | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo import api, fields, models | ||
|
||
|
||
class OnlineBankStatementProvider(models.Model): | ||
_inherit = "online.bank.statement.provider" | ||
plaid_access_token = fields.Char() | ||
plaid_host = fields.Selection( | ||
[ | ||
("development", "Development"), | ||
("sandbox", "Sandbox"), | ||
("production", "Production"), | ||
], | ||
default="sandbox", | ||
) | ||
|
||
def _obtain_statement_data(self, date_since, date_until): | ||
self.ensure_one() | ||
if self.service != "plaid": | ||
return super()._obtain_statement_data(date_since, date_until) | ||
Check warning on line 21 in account_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py Codecov / codecov/patchaccount_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py#L21
|
||
return self._plaid_retrieve_data(date_since, date_until), {} | ||
|
||
@api.model | ||
def _get_available_services(self): | ||
return super()._get_available_services() + [ | ||
("plaid", "Plaid.com"), | ||
] | ||
|
||
def action_sync_with_plaid(self): | ||
self.ensure_one() | ||
plaid_interface = self.env["plaid.interface"] | ||
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", | ||
"tag": "plaid_login", | ||
"args": {"token": plaid_link_token}, | ||
} | ||
|
||
def _plaid_retrieve_data(self, date_since, date_until): | ||
plaid_interface = self.env["plaid.interface"] | ||
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 | ||
) | ||
return self._prepare_vals_for_statement(transactions) | ||
|
||
def plaid_create_access_token(self, public_token, active_id): | ||
provider = self.browse(active_id) | ||
plaid_interface = self.env["plaid.interface"] | ||
client = plaid_interface._client( | ||
Check warning on line 54 in account_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py Codecov / codecov/patchaccount_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py#L52-L54
|
||
provider.username, provider.password, provider.plaid_host | ||
) | ||
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 Codecov / codecov/patchaccount_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py#L57-L58
|
||
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 Codecov / codecov/patchaccount_statement_import_online_plaid/models/online_bank_statement_provider_plaid.py#L60-L61
|
||
|
||
def _prepare_vals_for_statement(self, transactions): | ||
return [ | ||
{ | ||
"date": transaction["date"], | ||
"ref": transaction["name"], | ||
"payment_ref": transaction["name"], | ||
"unique_import_id": transaction["transaction_id"], | ||
"amount": transaction["amount"], | ||
"raw_data": transaction, | ||
} | ||
for transaction in transactions | ||
] |