Merge PR #685 into 16.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot
2024-04-23 06:40:31 +00:00
12 changed files with 272 additions and 22 deletions

View File

@@ -7,7 +7,7 @@ Online Bank Statements: GoCardless
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4d87690ed02f68a1c4cad9976f65c1109112c608a3d63dd93fdcca49e0319f2b
!! source digest: sha256:ee02b1d6ddcdef85f00fec3cfe359e76f897722fa2055e83769a41515b6455cb
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png

View File

@@ -1,4 +1,5 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import models
from . import controllers
from . import models
from . import wizards

View File

@@ -1,5 +1,5 @@
# Copyright 2022 ForgeFlow S.L.
# Copyright 2023 Tecnativa - Pedro M. Baeza
# Copyright 2023-2024 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Online Bank Statements: GoCardless",
@@ -12,7 +12,11 @@
"depends": [
"account_statement_import_online",
],
"data": ["view/online_bank_statement_provider.xml"],
"data": [
"security/ir.model.access.csv",
"view/online_bank_statement_provider.xml",
"wizards/online_bank_statement_provider_existing_views.xml",
],
"assets": {
"web.assets_backend": [
"account_statement_import_online_gocardless/static/src/"

View File

@@ -6,6 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-22 18:19+0000\n"
"PO-Revision-Date: 2024-04-22 18:19+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -13,6 +15,14 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: account_statement_import_online_gocardless
#: model_terms:ir.ui.view,arch_db:account_statement_import_online_gocardless.view_online_bank_statement_provider_existing_form
msgid ""
"<i class=\"fa fa-info-circle\"/> There's already another journal from the "
"same bank institution linked with GoCardless. Do you want to reuse the "
"existing credentials or create new ones?"
msgstr ""
#. module: account_statement_import_online_gocardless
#. odoo-javascript
#: code:addons/account_statement_import_online_gocardless/static/src/xml/select_bank_widget.xml:0
@@ -20,6 +30,28 @@ msgstr ""
msgid "Available countries:"
msgstr ""
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__create_uid
msgid "Created by"
msgstr ""
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__create_date
msgid "Created on"
msgstr ""
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__display_name
msgid "Display Name"
msgstr ""
#. module: account_statement_import_online_gocardless
#. odoo-python
#: code:addons/account_statement_import_online_gocardless/models/online_bank_statement_provider.py:0
#, python-format
msgid "Existing link"
msgstr ""
#. module: account_statement_import_online_gocardless
#: model_terms:ir.ui.view,arch_db:account_statement_import_online_gocardless.online_bank_statement_provider_form
msgid "GoCardless"
@@ -70,6 +102,11 @@ msgstr ""
msgid "Gocardless Token Expiration"
msgstr ""
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__id
msgid "ID"
msgstr ""
#. module: account_statement_import_online_gocardless
#. odoo-python
#: code:addons/account_statement_import_online_gocardless/models/online_bank_statement_provider.py:0
@@ -77,11 +114,46 @@ msgstr ""
msgid "Incorrect country code or country not supported."
msgstr ""
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing____last_update
msgid "Last Modified on"
msgstr ""
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__write_uid
msgid "Last Updated by"
msgstr ""
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__write_date
msgid "Last Updated on"
msgstr ""
#. module: account_statement_import_online_gocardless
#: model_terms:ir.ui.view,arch_db:account_statement_import_online_gocardless.view_online_bank_statement_provider_existing_form
msgid "New link"
msgstr ""
#. module: account_statement_import_online_gocardless
#: model:ir.model,name:account_statement_import_online_gocardless.model_online_bank_statement_provider
msgid "Online Bank Statement Provider"
msgstr ""
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__other_provider_id
msgid "Other Provider"
msgstr ""
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__provider_id
msgid "Provider"
msgstr ""
#. module: account_statement_import_online_gocardless
#: model_terms:ir.ui.view,arch_db:account_statement_import_online_gocardless.view_online_bank_statement_provider_existing_form
msgid "Reuse existing"
msgstr ""
#. module: account_statement_import_online_gocardless
#. odoo-javascript
#: code:addons/account_statement_import_online_gocardless/static/src/xml/select_bank_widget.xml:0
@@ -118,6 +190,13 @@ msgstr ""
msgid "Select Country to Filter"
msgstr ""
#. module: account_statement_import_online_gocardless
#: model_terms:ir.ui.view,arch_db:account_statement_import_online_gocardless.view_online_bank_statement_provider_existing_form
msgid ""
"Some banks only allow one credentials, while others work better with "
"separate ones, so it's a matter of trying."
msgstr ""
#. module: account_statement_import_online_gocardless
#. odoo-python
#: code:addons/account_statement_import_online_gocardless/models/online_bank_statement_provider.py:0
@@ -125,6 +204,11 @@ msgstr ""
msgid "To continue configure bank account on journal %s"
msgstr ""
#. module: account_statement_import_online_gocardless
#: model:ir.model,name:account_statement_import_online_gocardless.model_online_bank_statement_provider_existing
msgid "Wizard for reusing existing GoCardless provider"
msgstr ""
#. module: account_statement_import_online_gocardless
#. odoo-python
#: code:addons/account_statement_import_online_gocardless/models/online_bank_statement_provider.py:0

View File

@@ -6,15 +6,26 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-03-20 20:34+0000\n"
"POT-Creation-Date: 2024-04-22 18:19+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: MayteGLC <mayte.gonzalez@factorlibre.com>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.0.1\n"
#. module: account_statement_import_online_gocardless
#: model_terms:ir.ui.view,arch_db:account_statement_import_online_gocardless.view_online_bank_statement_provider_existing_form
msgid ""
"<i class=\"fa fa-info-circle\"/> There's already another journal from the "
"same bank institution linked with GoCardless. Do you want to reuse the "
"existing credentials or create new ones?"
msgstr ""
"<i class=\"fa fa-info-circle\"/> Ya existe otro diario de la misma "
"institución bancaria enlazado con GoCardless. ¿Quiere reutilizar las "
"credenciales existentes o crear unas nuevas?"
#. module: account_statement_import_online_gocardless
#. odoo-javascript
@@ -23,6 +34,28 @@ msgstr ""
msgid "Available countries:"
msgstr "Países disponibles:"
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__create_uid
msgid "Created by"
msgstr "Creado por"
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__create_date
msgid "Created on"
msgstr "Creado el"
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__display_name
msgid "Display Name"
msgstr "Nombre mostrado"
#. module: account_statement_import_online_gocardless
#. odoo-python
#: code:addons/account_statement_import_online_gocardless/models/online_bank_statement_provider.py:0
#, python-format
msgid "Existing link"
msgstr "Enlace existente"
#. module: account_statement_import_online_gocardless
#: model_terms:ir.ui.view,arch_db:account_statement_import_online_gocardless.online_bank_statement_provider_form
msgid "GoCardless"
@@ -73,6 +106,11 @@ msgstr "Token"
msgid "Gocardless Token Expiration"
msgstr "Caducdad del token"
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__id
msgid "ID"
msgstr "Identificador"
#. module: account_statement_import_online_gocardless
#. odoo-python
#: code:addons/account_statement_import_online_gocardless/models/online_bank_statement_provider.py:0
@@ -80,11 +118,46 @@ msgstr "Caducdad del token"
msgid "Incorrect country code or country not supported."
msgstr "Código de país incorrecto o país no admitido."
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing____last_update
msgid "Last Modified on"
msgstr "Última modificación el"
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__write_uid
msgid "Last Updated by"
msgstr "Última modificación por"
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__write_date
msgid "Last Updated on"
msgstr "Última modificación el"
#. module: account_statement_import_online_gocardless
#: model_terms:ir.ui.view,arch_db:account_statement_import_online_gocardless.view_online_bank_statement_provider_existing_form
msgid "New link"
msgstr "Nuevo enlace"
#. module: account_statement_import_online_gocardless
#: model:ir.model,name:account_statement_import_online_gocardless.model_online_bank_statement_provider
msgid "Online Bank Statement Provider"
msgstr "Proveedor de Extractos Bancarios en Línea"
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__other_provider_id
msgid "Other Provider"
msgstr "Otro proveedor"
#. module: account_statement_import_online_gocardless
#: model:ir.model.fields,field_description:account_statement_import_online_gocardless.field_online_bank_statement_provider_existing__provider_id
msgid "Provider"
msgstr "Proveedor"
#. module: account_statement_import_online_gocardless
#: model_terms:ir.ui.view,arch_db:account_statement_import_online_gocardless.view_online_bank_statement_provider_existing_form
msgid "Reuse existing"
msgstr "Reutilizar existente"
#. module: account_statement_import_online_gocardless
#. odoo-javascript
#: code:addons/account_statement_import_online_gocardless/static/src/xml/select_bank_widget.xml:0
@@ -121,6 +194,16 @@ msgstr "Seleccione el Banco de su Cuenta"
msgid "Select Country to Filter"
msgstr "Seleccione el País a Filtrar"
#. module: account_statement_import_online_gocardless
#: model_terms:ir.ui.view,arch_db:account_statement_import_online_gocardless.view_online_bank_statement_provider_existing_form
msgid ""
"Some banks only allow one credentials, while others work better with "
"separate ones, so it's a matter of trying."
msgstr ""
"Algunos bancos solo permiten unas credenciales, mientras otros funcionan "
"mejor con credenciales separadas, así que es una cuestión de probar ambas "
"opciones."
#. module: account_statement_import_online_gocardless
#. odoo-python
#: code:addons/account_statement_import_online_gocardless/models/online_bank_statement_provider.py:0
@@ -128,6 +211,11 @@ msgstr "Seleccione el País a Filtrar"
msgid "To continue configure bank account on journal %s"
msgstr "Para seguir configurando la cuenta bancaria en el diario %s"
#. module: account_statement_import_online_gocardless
#: model:ir.model,name:account_statement_import_online_gocardless.model_online_bank_statement_provider_existing
msgid "Wizard for reusing existing GoCardless provider"
msgstr "Asistente para reutilizar un proveedor de GoCardless existente"
#. module: account_statement_import_online_gocardless
#. odoo-python
#: code:addons/account_statement_import_online_gocardless/models/online_bank_statement_provider.py:0

View File

@@ -1,5 +1,5 @@
# Copyright 2022 ForgeFlow S.L.
# Copyright 2023 Tecnativa - Pedro M. Baeza
# Copyright 2023-2024 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import json
from datetime import datetime
@@ -104,8 +104,8 @@ class OnlineBankStatementProvider(models.Model):
% (self.journal_id.display_name)
)
# Check if there's another existing provider for the same bank institution,
# and reuse it for this bank account, as some banks don't allow several
# requisitions from the same source (GoCardless).
# and ask for reusing it for this bank account, as some banks don't allow
# several requisitions from the same source (GoCardless).
other = self.search(
[
("service", "=", "gocardless"),
@@ -116,19 +116,24 @@ class OnlineBankStatementProvider(models.Model):
limit=1,
)
if other:
self.write(
wizard = self.env["online.bank.statement.provider.existing"].create(
{
"gocardless_requisition_ref": other.gocardless_requisition_ref,
"gocardless_requisition_id": other.gocardless_requisition_id,
"gocardless_requisition_expiration": (
other.gocardless_requisition_expiration
),
"gocardless_institution_id": other.gocardless_institution_id,
"provider_id": self.id,
"other_provider_id": other.id,
}
)
if self._gocardless_finish_requisition(dry=True):
return
# Ask for the institution and continue normal process otherwise
return {
"type": "ir.actions.act_window",
"res_model": wizard._name,
"res_id": wizard.id,
"name": _("Existing link"),
"view_mode": "form",
"target": "new",
}
return self._gocardless_select_bank_instituion()
def _gocardless_select_bank_instituion(self):
"""Ask for the GoCardless bank instituion and continue full linkage."""
country = (
self.journal_id.bank_account_id.company_id or self.journal_id.company_id
).country_id

View File

@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_online_bank_statement_provider_existing,access_online_bank_statement_provider_existing,model_online_bank_statement_provider_existing,account.group_account_user,1,1,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_online_bank_statement_provider_existing access_online_bank_statement_provider_existing model_online_bank_statement_provider_existing account.group_account_user 1 1 1 0

View File

@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
@@ -366,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4d87690ed02f68a1c4cad9976f65c1109112c608a3d63dd93fdcca49e0319f2b
!! source digest: sha256:ee02b1d6ddcdef85f00fec3cfe359e76f897722fa2055e83769a41515b6455cb
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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 class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/bank-statement-import/tree/16.0/account_statement_import_online_gocardless"><img alt="OCA/bank-statement-import" src="https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/bank-statement-import-16-0/bank-statement-import-16-0-account_statement_import_online_gocardless"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/bank-statement-import&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module provides online bank statements from GoCardless Bank Account Data,

View File

@@ -39,6 +39,7 @@
<button
name="action_select_gocardless_bank"
string="Select Bank Account Identifier"
attrs="{'invisible': ['|', ('username', '=', False), ('password', '=', False)]}"
type="object"
/>
</group>

View File

@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import online_bank_statement_provider_existing

View File

@@ -0,0 +1,31 @@
# Copyright 2024 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class OnlineBankStatementProviderExisting(models.TransientModel):
_name = "online.bank.statement.provider.existing"
_description = "Wizard for reusing existing GoCardless provider"
_rec_name = "provider_id"
provider_id = fields.Many2one(comodel_name="online.bank.statement.provider")
other_provider_id = fields.Many2one(comodel_name="online.bank.statement.provider")
def link_existing(self):
provider = self.provider_id
other = self.other_provider_id
provider.write(
{
"gocardless_requisition_ref": other.gocardless_requisition_ref,
"gocardless_requisition_id": other.gocardless_requisition_id,
"gocardless_requisition_expiration": (
other.gocardless_requisition_expiration
),
"gocardless_institution_id": other.gocardless_institution_id,
}
)
provider._gocardless_finish_requisition(dry=True)
def new_link(self):
return self.provider_id._gocardless_select_bank_instituion()

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2024 Tecnativa - Pedro M. Baeza
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_online_bank_statement_provider_existing_form" model="ir.ui.view">
<field name="model">online.bank.statement.provider.existing</field>
<field name="arch" type="xml">
<form>
<div class="oe_form_box_info bg-info oe_text_center">
<p><i
class="fa fa-info-circle"
/> There's already another journal from the same bank institution linked with GoCardless. Do you want to reuse the existing credentials or create new ones?</p>
</div>
<br />
<div>
<p
>Some banks only allow one credentials, while others work better with separate ones, so it's a matter of trying.</p>
</div>
<footer>
<button
name="link_existing"
type="object"
string="Reuse existing"
/>
<button name="new_link" type="object" string="New link" />
</footer>
</form>
</field>
</record>
</odoo>