mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[MIG] account_statement_import_online_gocardless: Migration to 16.0
This commit is contained in:
committed by
Nicolas JEUDY
parent
cd726f896b
commit
e557786c9f
@@ -7,7 +7,7 @@ Online Bank Statements: GoCardless
|
|||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! changes will be overwritten. !!
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
!! source digest: sha256:7a5de14c24a125d23a9fdba3ee6f041af430db49bb390e327f4a6ed2c4e11071
|
!! source digest: sha256:7e08b9033d303931d6ce5d4c420d57a3615ef932c2680ce05c103f37e6141654
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||||
@@ -17,13 +17,13 @@ Online Bank Statements: GoCardless
|
|||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github
|
.. |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/15.0/account_statement_import_online_gocardless
|
:target: https://github.com/OCA/bank-statement-import/tree/16.0/account_statement_import_online_gocardless
|
||||||
:alt: OCA/bank-statement-import
|
:alt: OCA/bank-statement-import
|
||||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
:target: https://translation.odoo-community.org/projects/bank-statement-import-15-0/bank-statement-import-15-0-account_statement_import_online_gocardless
|
:target: https://translation.odoo-community.org/projects/bank-statement-import-16-0/bank-statement-import-16-0-account_statement_import_online_gocardless
|
||||||
:alt: Translate me on Weblate
|
:alt: Translate me on Weblate
|
||||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
.. |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=15.0
|
:target: https://runboat.odoo-community.org/builds?repo=OCA/bank-statement-import&target_branch=16.0
|
||||||
:alt: Try me on Runboat
|
:alt: Try me on Runboat
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
@@ -69,11 +69,11 @@ To configure online bank statements provider:
|
|||||||
#. Put your secret ID and secret key on the existing fields.
|
#. Put your secret ID and secret key on the existing fields.
|
||||||
#. Click on the button "Select Bank Account Identifier".
|
#. Click on the button "Select Bank Account Identifier".
|
||||||
|
|
||||||
.. image:: https://raw.githubusercontent.com/OCA/bank-statement-import/15.0/account_statement_import_online_gocardless/static/img/gocardless_configuration.gif
|
.. image:: https://raw.githubusercontent.com/OCA/bank-statement-import/16.0/account_statement_import_online_gocardless/static/img/gocardless_configuration.gif
|
||||||
|
|
||||||
#. A new window will appear for selecting the bank entity.
|
#. A new window will appear for selecting the bank entity.
|
||||||
|
|
||||||
.. image:: https://raw.githubusercontent.com/OCA/bank-statement-import/15.0/account_statement_import_online_gocardless/static/img/gocardless_bank_selection.gif
|
.. image:: https://raw.githubusercontent.com/OCA/bank-statement-import/16.0/account_statement_import_online_gocardless/static/img/gocardless_bank_selection.gif
|
||||||
|
|
||||||
#. Select it, and you will be redirected to the selected entity for introducing
|
#. Select it, and you will be redirected to the selected entity for introducing
|
||||||
your bank credentials to allow the connection.
|
your bank credentials to allow the connection.
|
||||||
@@ -103,7 +103,7 @@ Bug Tracker
|
|||||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-statement-import/issues>`_.
|
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.
|
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
|
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_gocardless%0Aversion:%2015.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_gocardless%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.
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
@@ -140,6 +140,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
|||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.
|
promote its widespread use.
|
||||||
|
|
||||||
This module is part of the `OCA/bank-statement-import <https://github.com/OCA/bank-statement-import/tree/15.0/account_statement_import_online_gocardless>`_ 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_gocardless>`_ project on GitHub.
|
||||||
|
|
||||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
{
|
{
|
||||||
"name": "Online Bank Statements: GoCardless",
|
"name": "Online Bank Statements: GoCardless",
|
||||||
"version": "15.0.1.0.0",
|
"version": "16.0.1.0.0",
|
||||||
"category": "Account",
|
"category": "Account",
|
||||||
"website": "https://github.com/OCA/bank-statement-import",
|
"website": "https://github.com/OCA/bank-statement-import",
|
||||||
"author": "ForgeFlow, Tecnativa, Odoo Community Association (OCA)",
|
"author": "ForgeFlow, Tecnativa, Odoo Community Association (OCA)",
|
||||||
@@ -19,10 +19,8 @@
|
|||||||
"lib/gocardless-ui/selector.css",
|
"lib/gocardless-ui/selector.css",
|
||||||
"account_statement_import_online_gocardless/static/src/"
|
"account_statement_import_online_gocardless/static/src/"
|
||||||
"js/select_bank_widget.js",
|
"js/select_bank_widget.js",
|
||||||
],
|
"account_statement_import_online_gocardless/static/src/"
|
||||||
"web.assets_qweb": [
|
"xml/select_bank_widget.xml",
|
||||||
"account_statement_import_online_gocardless/static/src/xml"
|
|
||||||
"/select_bank_widget.xml"
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ from odoo.exceptions import UserError
|
|||||||
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
|
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
|
||||||
|
|
||||||
GOCARDLESS_ENDPOINT = "https://bankaccountdata.gocardless.com/api/v2"
|
GOCARDLESS_ENDPOINT = "https://bankaccountdata.gocardless.com/api/v2"
|
||||||
|
REQUESTS_TIMEOUT = 5
|
||||||
|
|
||||||
|
|
||||||
class OnlineBankStatementProvider(models.Model):
|
class OnlineBankStatementProvider(models.Model):
|
||||||
@@ -67,6 +68,7 @@ class OnlineBankStatementProvider(models.Model):
|
|||||||
{"secret_id": self.username, "secret_key": self.password}
|
{"secret_id": self.username, "secret_key": self.password}
|
||||||
),
|
),
|
||||||
headers=self._gocardless_get_headers(basic=True),
|
headers=self._gocardless_get_headers(basic=True),
|
||||||
|
timeout=REQUESTS_TIMEOUT,
|
||||||
)
|
)
|
||||||
data = {}
|
data = {}
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
@@ -108,6 +110,7 @@ class OnlineBankStatementProvider(models.Model):
|
|||||||
f"{GOCARDLESS_ENDPOINT}/institutions/",
|
f"{GOCARDLESS_ENDPOINT}/institutions/",
|
||||||
params={"country": country.code},
|
params={"country": country.code},
|
||||||
headers=self._gocardless_get_headers(),
|
headers=self._gocardless_get_headers(),
|
||||||
|
timeout=REQUESTS_TIMEOUT,
|
||||||
)
|
)
|
||||||
if response.status_code == 400:
|
if response.status_code == 400:
|
||||||
raise UserError(_("Incorrect country code or country not supported."))
|
raise UserError(_("Incorrect country code or country not supported."))
|
||||||
@@ -148,6 +151,7 @@ class OnlineBankStatementProvider(models.Model):
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
headers=self._gocardless_get_headers(),
|
headers=self._gocardless_get_headers(),
|
||||||
|
timeout=REQUESTS_TIMEOUT,
|
||||||
)
|
)
|
||||||
if response.status_code == 201:
|
if response.status_code == 201:
|
||||||
requisition_data = json.loads(response.text)
|
requisition_data = json.loads(response.text)
|
||||||
@@ -167,6 +171,7 @@ class OnlineBankStatementProvider(models.Model):
|
|||||||
requisition_response = requests.get(
|
requisition_response = requests.get(
|
||||||
f"{GOCARDLESS_ENDPOINT}/requisitions/{self.gocardless_requisition_id}/",
|
f"{GOCARDLESS_ENDPOINT}/requisitions/{self.gocardless_requisition_id}/",
|
||||||
headers=self._gocardless_get_headers(),
|
headers=self._gocardless_get_headers(),
|
||||||
|
timeout=REQUESTS_TIMEOUT,
|
||||||
)
|
)
|
||||||
requisition_data = json.loads(requisition_response.text)
|
requisition_data = json.loads(requisition_response.text)
|
||||||
accounts = requisition_data.get("accounts", [])
|
accounts = requisition_data.get("accounts", [])
|
||||||
@@ -176,6 +181,7 @@ class OnlineBankStatementProvider(models.Model):
|
|||||||
account_response = requests.get(
|
account_response = requests.get(
|
||||||
f"{GOCARDLESS_ENDPOINT}/accounts/{account_id}/",
|
f"{GOCARDLESS_ENDPOINT}/accounts/{account_id}/",
|
||||||
headers=self._gocardless_get_headers(),
|
headers=self._gocardless_get_headers(),
|
||||||
|
timeout=REQUESTS_TIMEOUT,
|
||||||
)
|
)
|
||||||
if account_response.status_code == 200:
|
if account_response.status_code == 200:
|
||||||
account_data = json.loads(account_response.text)
|
account_data = json.loads(account_response.text)
|
||||||
@@ -192,6 +198,7 @@ class OnlineBankStatementProvider(models.Model):
|
|||||||
f"{GOCARDLESS_ENDPOINT}/agreements/enduser/"
|
f"{GOCARDLESS_ENDPOINT}/agreements/enduser/"
|
||||||
f"{requisition_data['agreement']}/",
|
f"{requisition_data['agreement']}/",
|
||||||
headers=self._gocardless_get_headers(),
|
headers=self._gocardless_get_headers(),
|
||||||
|
timeout=REQUESTS_TIMEOUT,
|
||||||
)
|
)
|
||||||
agreement_data = json.loads(agreement_response.text)
|
agreement_data = json.loads(agreement_response.text)
|
||||||
self.gocardless_requisition_expiration = datetime.strptime(
|
self.gocardless_requisition_expiration = datetime.strptime(
|
||||||
@@ -243,6 +250,7 @@ class OnlineBankStatementProvider(models.Model):
|
|||||||
"date_to": date_until.strftime(DF),
|
"date_to": date_until.strftime(DF),
|
||||||
},
|
},
|
||||||
headers=self._gocardless_get_headers(),
|
headers=self._gocardless_get_headers(),
|
||||||
|
timeout=REQUESTS_TIMEOUT,
|
||||||
)
|
)
|
||||||
if transaction_response.status_code == 200:
|
if transaction_response.status_code == 200:
|
||||||
return json.loads(transaction_response.text)
|
return json.loads(transaction_response.text)
|
||||||
|
|||||||
@@ -5,3 +5,6 @@
|
|||||||
* `Tecnativa <https://www.tecnativa.com>`__:
|
* `Tecnativa <https://www.tecnativa.com>`__:
|
||||||
|
|
||||||
* Pedro M. Baeza
|
* Pedro M. Baeza
|
||||||
|
* `Alusage <https://nicolas.alusage.fr>`__:
|
||||||
|
|
||||||
|
* Nicolas JEUDY <https://github.com/njeudy>
|
||||||
|
|||||||
@@ -516,7 +516,7 @@ div.compound .compound-last, div.compound .compound-middle {
|
|||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! changes will be overwritten. !!
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
!! source digest: sha256:5523e4b06eaa38f0f74b6181f2043b93037f673d8a5038474c13dc323f1492ac
|
!! source digest: sha256:7e08b9033d303931d6ce5d4c420d57a3615ef932c2680ce05c103f37e6141654
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img
|
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img
|
||||||
alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a
|
alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ class TestAccountBankAccountStatementImportOnlineGocardless(common.TransactionCa
|
|||||||
|
|
||||||
def test_mocked_gocardless(self):
|
def test_mocked_gocardless(self):
|
||||||
vals = {
|
vals = {
|
||||||
"provider_ids": self.provider.ids,
|
|
||||||
"date_since": "2020-10-30",
|
"date_since": "2020-10-30",
|
||||||
"date_until": "2020-11-11",
|
"date_until": "2020-11-11",
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user