diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 460e7d874..ee4536488 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -123,7 +123,7 @@ repos: hooks: - id: flake8 name: flake8 - additional_dependencies: ["flake8-bugbear==21.9.2"] + additional_dependencies: ["flake8-bugbear==21.9.2", "importlib-metadata<5.0.0"] - repo: https://github.com/OCA/pylint-odoo rev: 7.0.2 hooks: diff --git a/account_statement_import_online/README.rst b/account_statement_import_online/README.rst new file mode 100644 index 000000000..3ab2a5ba8 --- /dev/null +++ b/account_statement_import_online/README.rst @@ -0,0 +1,131 @@ +====================== +Online Bank Statements +====================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/15.0/account_statement_import_online + :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-15-0/bank-statement-import-15-0-account_statement_import_online + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/174/15.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module provides base for building online bank statements providers. + +**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 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 online bank statements provider in *Online Bank Statements (OCA)* + section +#. Save the bank account +#. Click on provider and configure provider-specific settings. + +If you want to allow empty bank statements to be created every time the +information is pulled, you can check the option "Allow empty statements" +at the provider configuration level. + +**NOTE**: To access these features, user needs to belong to +*Show Full Accounting Features* group. + +Usage +===== + +To pull historical bank statements: + +#. Go to *Invoicing > Configuration > Bank Accounts* +#. Select specific bank accounts +#. Launch *Actions > Online Bank Statements Pull Wizard* +#. Configure date interval and click *Pull* + +**NOTE**: To access these features, user needs to belong to +*Show Full Accounting Features* group. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* CorporateHub + +Contributors +~~~~~~~~~~~~ + +* `CorporateHub `__ + + * Alexey Pelykh + +* `Therp BV `__ + + * Ronald Portier + +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-alexey-pelykh| image:: https://github.com/alexey-pelykh.png?size=40px + :target: https://github.com/alexey-pelykh + :alt: alexey-pelykh + +Current `maintainer `__: + +|maintainer-alexey-pelykh| + +This module is part of the `OCA/bank-statement-import `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_statement_import_online/__init__.py b/account_statement_import_online/__init__.py new file mode 100644 index 000000000..adc6207fd --- /dev/null +++ b/account_statement_import_online/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import models +from . import wizards diff --git a/account_statement_import_online/__manifest__.py b/account_statement_import_online/__manifest__.py new file mode 100644 index 000000000..459a94953 --- /dev/null +++ b/account_statement_import_online/__manifest__.py @@ -0,0 +1,28 @@ +# Copyright 2019-2020 Brainbean Apps (https://brainbeanapps.com) +# Copyright 2020 CorporateHub (https://corporatehub.eu) +# Copyright 2023 Therp BV (https://therp.nl) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Online Bank Statements", + "version": "16.0.1.0.0", + "author": "CorporateHub, Odoo Community Association (OCA)", + "maintainers": ["alexey-pelykh"], + "website": "https://github.com/OCA/bank-statement-import", + "license": "AGPL-3", + "category": "Accounting", + "summary": "Online bank statements update", + "depends": [ + "account_statement_import_base", + ], + "data": [ + "data/account_statement_import_online.xml", + "security/ir.model.access.csv", + "security/online_bank_statement_provider.xml", + "wizards/online_bank_statement_pull_wizard.xml", + "views/actions.xml", + "views/account_journal.xml", + "views/online_bank_statement_provider.xml", + ], + "installable": True, +} diff --git a/account_statement_import_online/data/account_statement_import_online.xml b/account_statement_import_online/data/account_statement_import_online.xml new file mode 100644 index 000000000..3df898e4c --- /dev/null +++ b/account_statement_import_online/data/account_statement_import_online.xml @@ -0,0 +1,22 @@ + + + + + Pull Online Bank Statements + 1 + hours + -1 + code + 2019-01-01 00:10:00 + + + model._scheduled_pull() + + diff --git a/account_statement_import_online/i18n/account_statement_import_online.pot b/account_statement_import_online/i18n/account_statement_import_online.pot new file mode 100644 index 000000000..f57a1cbc9 --- /dev/null +++ b/account_statement_import_online/i18n/account_statement_import_online.pot @@ -0,0 +1,487 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_statement_import_online +# +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_online +#: code:addons/account_statement_import_online/models/online_bank_statement_provider.py:0 +#, python-format +msgid "%(number)s %(type)s" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_needaction +msgid "Action Needed" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__active +msgid "Active" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__api_base +msgid "Api Base" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_form +msgid "Archived" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_attachment_count +msgid "Attachment Count" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_pull_wizard_form +msgid "Cancel" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__certificate +msgid "Certificate" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__certificate_chain +msgid "Certificate Chain" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__certificate_private_key +msgid "Certificate Private Key" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__certificate_public_key +msgid "Certificate Public Key" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__company_id +msgid "Company" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__company_id +msgid "Company related to this journal" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_form +msgid "Configuration" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__create_uid +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__create_uid +msgid "Created by" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__create_date +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__create_date +msgid "Created on" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__currency_id +msgid "Currency" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__statement_creation_mode__daily +msgid "Daily statements" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__interval_type__days +msgid "Day(s)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_account_journal__display_name +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__display_name +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__display_name +msgid "Display Name" +msgstr "" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/online_bank_statement_provider.py:0 +#, python-format +msgid "" +"Failed to obtain statement data for period since %s until %s: %s. See server" +" logs for more details." +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_follower_ids +msgid "Followers" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_channel_ids +msgid "Followers (Channels)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_partner_ids +msgid "Followers (Partners)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__date_since +msgid "From" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__interval_type__hours +msgid "Hour(s)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_account_journal__id +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__id +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__id +msgid "ID" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_needaction +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_unread +msgid "If checked, new messages require your attention." +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_has_error +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_has_sms_error +msgid "If checked, some messages have a delivery error." +msgstr "" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/online_bank_statement_provider.py:0 +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_filter +#, python-format +msgid "Inactive" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__interval_type +msgid "Interval Type" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_is_follower +msgid "Is Follower" +msgstr "" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/online_bank_statement_provider.py:0 +#, python-format +msgid "Issue with Online Bank Statement Provider" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model,name:account_statement_import_online.model_account_journal +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__journal_id +msgid "Journal" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__key +msgid "Key" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_account_journal____last_update +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider____last_update +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard____last_update +msgid "Last Modified on" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__write_uid +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__write_date +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__write_date +msgid "Last Updated on" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__last_successful_run +msgid "Last successful pull" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_main_attachment_id +msgid "Main Attachment" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_has_error +msgid "Message Delivery error" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_ids +msgid "Messages" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__interval_type__minutes +msgid "Minute(s)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__statement_creation_mode__monthly +msgid "Monthly statements" +msgstr "" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/online_bank_statement_provider.py:0 +#, python-format +msgid "N/A" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__name +msgid "Name" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__next_run +msgid "Next scheduled pull" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_needaction_counter +msgid "Number of Actions" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_has_error_counter +msgid "Number of errors" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_needaction_counter +msgid "Number of messages which requires an action" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_has_error_counter +msgid "Number of messages with delivery error" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_unread_counter +msgid "Number of unread messages" +msgstr "" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/account_journal.py:0 +#, python-format +msgid "Online (OCA)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model,name:account_statement_import_online.model_online_bank_statement_provider +#: model:ir.model.fields,field_description:account_statement_import_online.field_account_journal__online_bank_statement_provider +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_form +msgid "Online Bank Statement Provider" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.actions.act_window,name:account_statement_import_online.online_bank_statement_provider_action +#: model:ir.ui.menu,name:account_statement_import_online.online_bank_statement_provider_menu +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_filter +msgid "Online Bank Statement Providers" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model,name:account_statement_import_online.model_online_bank_statement_pull_wizard +msgid "Online Bank Statement Pull Wizard" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.view_account_journal_form +msgid "Online Bank Statements (OCA)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.actions.act_window,name:account_statement_import_online.action_online_bank_statements_pull_wizard +msgid "Online Bank Statements Pull Wizard" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.constraint,message:account_statement_import_online.constraint_online_bank_statement_provider_journal_id_uniq +msgid "Only one online banking statement provider per journal!" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__origin +msgid "Origin" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__passphrase +msgid "Passphrase" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__password +msgid "Password" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.view_account_journal_form +msgid "Provider" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_pull_wizard_form +msgid "Pull" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.view_account_journal_form +msgid "Pull Online Bank Statement" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.actions.server,name:account_statement_import_online.ir_cron_account_pull_online_bank_statements_ir_actions_server +#: model:ir.cron,cron_name:account_statement_import_online.ir_cron_account_pull_online_bank_statements +#: model:ir.cron,name:account_statement_import_online.ir_cron_account_pull_online_bank_statements +msgid "Pull Online Bank Statements" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_has_sms_error +msgid "SMS Delivery error" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__account_number +msgid "Sanitized Account Number" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_form +msgid "Scheduled Pull" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__interval_number +msgid "Scheduled update interval" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.constraint,message:account_statement_import_online.constraint_online_bank_statement_provider_valid_interval_number +msgid "Scheduled update interval must be greater than zero!" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_account_journal__online_bank_statement_provider_id +msgid "" +"Select the actual instance of a configured provider (a record).\n" +"Selecting a type of provider will automatically create a provider record linked to this journal." +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_account_journal__online_bank_statement_provider +msgid "Select the type of service provider (a model)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__service +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_filter +msgid "Service" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__statement_creation_mode +msgid "Statement Creation Mode" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_account_journal__online_bank_statement_provider_id +msgid "Statement Provider" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__currency_id +msgid "The currency used to enter statement" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__tz +msgid "Timezone" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__tz +msgid "" +"Timezone to convert transaction timestamps to prior being saved into a " +"statement." +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__date_until +msgid "To" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_unread +msgid "Unread Messages" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_unread_counter +msgid "Unread Messages Counter" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__update_schedule +msgid "Update Schedule" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__username +msgid "Username" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__website_message_ids +msgid "Website Messages" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__website_message_ids +msgid "Website communication history" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__interval_type__weeks +msgid "Week(s)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__statement_creation_mode__weekly +msgid "Weekly statements" +msgstr "" diff --git a/account_statement_import_online/i18n/it.po b/account_statement_import_online/i18n/it.po new file mode 100644 index 000000000..29e47ace2 --- /dev/null +++ b/account_statement_import_online/i18n/it.po @@ -0,0 +1,491 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_statement_import_online +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-01-02 11:46+0000\n" +"Last-Translator: Francesco Foresti \n" +"Language-Team: none\n" +"Language: it\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.14.1\n" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/online_bank_statement_provider.py:0 +#, python-format +msgid "%(number)s %(type)s" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_needaction +msgid "Action Needed" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__active +msgid "Active" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__api_base +msgid "Api Base" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_form +msgid "Archived" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_attachment_count +msgid "Attachment Count" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_pull_wizard_form +msgid "Cancel" +msgstr "Annulla" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__certificate +msgid "Certificate" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__certificate_chain +msgid "Certificate Chain" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__certificate_private_key +msgid "Certificate Private Key" +msgstr "Chiave privata certificato" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__certificate_public_key +msgid "Certificate Public Key" +msgstr "Chiave pubblica certificato" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__company_id +msgid "Company" +msgstr "Azienda" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__company_id +msgid "Company related to this journal" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_form +msgid "Configuration" +msgstr "Configurazione" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__create_uid +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__create_uid +msgid "Created by" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__create_date +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__create_date +msgid "Created on" +msgstr "Creato il" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__currency_id +msgid "Currency" +msgstr "Valuta" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__statement_creation_mode__daily +msgid "Daily statements" +msgstr "Estratti conto giornalieri" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__interval_type__days +msgid "Day(s)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_account_journal__display_name +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__display_name +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/online_bank_statement_provider.py:0 +#, python-format +msgid "" +"Failed to obtain statement data for period since %s until %s: %s. See server " +"logs for more details." +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_follower_ids +msgid "Followers" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_channel_ids +msgid "Followers (Channels)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_partner_ids +msgid "Followers (Partners)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__date_since +msgid "From" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__interval_type__hours +msgid "Hour(s)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_account_journal__id +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__id +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__id +msgid "ID" +msgstr "ID" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_needaction +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_unread +msgid "If checked, new messages require your attention." +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_has_error +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_has_sms_error +msgid "If checked, some messages have a delivery error." +msgstr "" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/online_bank_statement_provider.py:0 +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_filter +#, python-format +msgid "Inactive" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__interval_type +msgid "Interval Type" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_is_follower +msgid "Is Follower" +msgstr "" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/online_bank_statement_provider.py:0 +#, python-format +msgid "Issue with Online Bank Statement Provider" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model,name:account_statement_import_online.model_account_journal +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__journal_id +msgid "Journal" +msgstr "Registro" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__key +msgid "Key" +msgstr "Chiave" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_account_journal____last_update +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider____last_update +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__write_uid +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__write_uid +msgid "Last Updated by" +msgstr "Ultimo aggiornamento di" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__write_date +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__write_date +msgid "Last Updated on" +msgstr "Ultimo aggiornamento il" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__last_successful_run +msgid "Last successful pull" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_main_attachment_id +msgid "Main Attachment" +msgstr "Allegato principale" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_has_error +msgid "Message Delivery error" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_ids +msgid "Messages" +msgstr "Messaggi" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__interval_type__minutes +msgid "Minute(s)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__statement_creation_mode__monthly +msgid "Monthly statements" +msgstr "Estratti conto mensili" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/online_bank_statement_provider.py:0 +#, python-format +msgid "N/A" +msgstr "N/D" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__name +msgid "Name" +msgstr "Nome" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__next_run +msgid "Next scheduled pull" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_needaction_counter +msgid "Number of Actions" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_has_error_counter +msgid "Number of errors" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_needaction_counter +msgid "Number of messages which requires an action" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_has_error_counter +msgid "Number of messages with delivery error" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_unread_counter +msgid "Number of unread messages" +msgstr "" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/account_journal.py:0 +#, python-format +msgid "Online (OCA)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model,name:account_statement_import_online.model_online_bank_statement_provider +#: model:ir.model.fields,field_description:account_statement_import_online.field_account_journal__online_bank_statement_provider +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_form +msgid "Online Bank Statement Provider" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.actions.act_window,name:account_statement_import_online.online_bank_statement_provider_action +#: model:ir.ui.menu,name:account_statement_import_online.online_bank_statement_provider_menu +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_filter +msgid "Online Bank Statement Providers" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model,name:account_statement_import_online.model_online_bank_statement_pull_wizard +msgid "Online Bank Statement Pull Wizard" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.view_account_journal_form +msgid "Online Bank Statements (OCA)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.actions.act_window,name:account_statement_import_online.action_online_bank_statements_pull_wizard +msgid "Online Bank Statements Pull Wizard" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.constraint,message:account_statement_import_online.constraint_online_bank_statement_provider_journal_id_uniq +msgid "Only one online banking statement provider per journal!" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__origin +msgid "Origin" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__passphrase +msgid "Passphrase" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__password +msgid "Password" +msgstr "Password" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.view_account_journal_form +msgid "Provider" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_pull_wizard_form +msgid "Pull" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.view_account_journal_form +msgid "Pull Online Bank Statement" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.actions.server,name:account_statement_import_online.ir_cron_account_pull_online_bank_statements_ir_actions_server +#: model:ir.cron,cron_name:account_statement_import_online.ir_cron_account_pull_online_bank_statements +#: model:ir.cron,name:account_statement_import_online.ir_cron_account_pull_online_bank_statements +msgid "Pull Online Bank Statements" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_has_sms_error +msgid "SMS Delivery error" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__account_number +msgid "Sanitized Account Number" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_form +msgid "Scheduled Pull" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__interval_number +msgid "Scheduled update interval" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.constraint,message:account_statement_import_online.constraint_online_bank_statement_provider_valid_interval_number +msgid "Scheduled update interval must be greater than zero!" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_account_journal__online_bank_statement_provider_id +msgid "" +"Select the actual instance of a configured provider (a record).\n" +"Selecting a type of provider will automatically create a provider record " +"linked to this journal." +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_account_journal__online_bank_statement_provider +msgid "Select the type of service provider (a model)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__service +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_filter +msgid "Service" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__statement_creation_mode +msgid "Statement Creation Mode" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_account_journal__online_bank_statement_provider_id +msgid "Statement Provider" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__currency_id +msgid "The currency used to enter statement" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__tz +msgid "Timezone" +msgstr "Fuso orario" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__tz +msgid "" +"Timezone to convert transaction timestamps to prior being saved into a " +"statement." +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__date_until +msgid "To" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_unread +msgid "Unread Messages" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_unread_counter +msgid "Unread Messages Counter" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__update_schedule +msgid "Update Schedule" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__username +msgid "Username" +msgstr "Nome utente" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__website_message_ids +msgid "Website Messages" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__website_message_ids +msgid "Website communication history" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__interval_type__weeks +msgid "Week(s)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__statement_creation_mode__weekly +msgid "Weekly statements" +msgstr "Estratti conto settimanali" diff --git a/account_statement_import_online/i18n/nl.po b/account_statement_import_online/i18n/nl.po new file mode 100644 index 000000000..7564c5a17 --- /dev/null +++ b/account_statement_import_online/i18n/nl.po @@ -0,0 +1,509 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_statement_import_online +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-04-23 18:47+0000\n" +"Last-Translator: Bosd \n" +"Language-Team: none\n" +"Language: nl\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.3.2\n" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/online_bank_statement_provider.py:0 +#, python-format +msgid "%(number)s %(type)s" +msgstr "%(number)s %(type)s" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_needaction +msgid "Action Needed" +msgstr "Actie vereist" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__active +msgid "Active" +msgstr "Actief" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__api_base +msgid "Api Base" +msgstr "Api Base" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_form +msgid "Archived" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_attachment_count +msgid "Attachment Count" +msgstr "Aantal Bijlagen" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_pull_wizard_form +msgid "Cancel" +msgstr "Annuleer" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__certificate +msgid "Certificate" +msgstr "Certificaat" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__certificate_chain +msgid "Certificate Chain" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__certificate_private_key +msgid "Certificate Private Key" +msgstr "Certificaat privé sleutel" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__certificate_public_key +msgid "Certificate Public Key" +msgstr "Certificaat publieke sleutel" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__company_id +msgid "Company" +msgstr "Bedrijf" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__company_id +msgid "Company related to this journal" +msgstr "Bedrijf gerelateerd aan dit dagboek" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_form +msgid "Configuration" +msgstr "Configuratie" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__create_uid +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__create_uid +msgid "Created by" +msgstr "Aangemaakt door" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__create_date +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__create_date +msgid "Created on" +msgstr "Aangemaakt op" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__currency_id +msgid "Currency" +msgstr "Valuta" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__statement_creation_mode__daily +msgid "Daily statements" +msgstr "Dagelijks afschrift" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__interval_type__days +msgid "Day(s)" +msgstr "Dag(en)" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_account_journal__display_name +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__display_name +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__display_name +msgid "Display Name" +msgstr "Weergavenaam" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/online_bank_statement_provider.py:0 +#, python-format +msgid "" +"Failed to obtain statement data for period since %s until %s: %s. See server " +"logs for more details." +msgstr "" +"Kon de afschriften niet verkrijgen voor de periode van %s tot %s:%s. Bekijk " +"de error log van de server voor details." + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_follower_ids +msgid "Followers" +msgstr "Volgers" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_channel_ids +msgid "Followers (Channels)" +msgstr "Volgers (Kanalen)" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_partner_ids +msgid "Followers (Partners)" +msgstr "Volgers (Partners)" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__date_since +msgid "From" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__interval_type__hours +msgid "Hour(s)" +msgstr "Uur/Uren" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_account_journal__id +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__id +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__id +msgid "ID" +msgstr "ID" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_needaction +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_unread +msgid "If checked, new messages require your attention." +msgstr "Indien aangevinkt, nieuwe berichten vereisen uw aandacht." + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_has_error +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_has_sms_error +msgid "If checked, some messages have a delivery error." +msgstr "Indien aangevinkt, sommige berichten hebben een foutmelding." + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/online_bank_statement_provider.py:0 +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_filter +#, python-format +msgid "Inactive" +msgstr "inactief" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__interval_type +msgid "Interval Type" +msgstr "Interval Type" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_is_follower +msgid "Is Follower" +msgstr "Is volger" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/online_bank_statement_provider.py:0 +#, python-format +msgid "Issue with Online Bank Statement Provider" +msgstr "Probleem met Online Bank afschrift leverancier" + +#. module: account_statement_import_online +#: model:ir.model,name:account_statement_import_online.model_account_journal +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__journal_id +msgid "Journal" +msgstr "Dagboek" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__key +msgid "Key" +msgstr "Sleutel" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_account_journal____last_update +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider____last_update +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard____last_update +msgid "Last Modified on" +msgstr "Laatst bijgewerkt op" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__write_uid +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__write_uid +msgid "Last Updated by" +msgstr "Laatst bijgewerkt door" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__write_date +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__write_date +msgid "Last Updated on" +msgstr "Laatst bijgewerkt op" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__last_successful_run +msgid "Last successful pull" +msgstr "Laatst succesvolle opvraag" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_main_attachment_id +msgid "Main Attachment" +msgstr "Hoofdbijlage" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_has_error +msgid "Message Delivery error" +msgstr "Berichtafleverinsfout" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_ids +msgid "Messages" +msgstr "Berichten" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__interval_type__minutes +msgid "Minute(s)" +msgstr "Minuut/Minuten" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__statement_creation_mode__monthly +msgid "Monthly statements" +msgstr "Maandelijkse afschriften" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/online_bank_statement_provider.py:0 +#, python-format +msgid "N/A" +msgstr "N.V.T." + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__name +msgid "Name" +msgstr "Naam" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__next_run +msgid "Next scheduled pull" +msgstr "Volgende geplande opvraag" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_needaction_counter +msgid "Number of Actions" +msgstr "Aantal acties" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_has_error_counter +msgid "Number of errors" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_needaction_counter +msgid "Number of messages which requires an action" +msgstr "Aantal berichten welke actie vereisen" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_has_error_counter +msgid "Number of messages with delivery error" +msgstr "Aantal berichten met afleveringsfouten" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__message_unread_counter +msgid "Number of unread messages" +msgstr "Aantal ongelezen berichten" + +#. module: account_statement_import_online +#: code:addons/account_statement_import_online/models/account_journal.py:0 +#, python-format +msgid "Online (OCA)" +msgstr "Online (OCA)" + +#. module: account_statement_import_online +#: model:ir.model,name:account_statement_import_online.model_online_bank_statement_provider +#: model:ir.model.fields,field_description:account_statement_import_online.field_account_journal__online_bank_statement_provider +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_form +msgid "Online Bank Statement Provider" +msgstr "Online Bank afschrift Aanbieder" + +#. module: account_statement_import_online +#: model:ir.actions.act_window,name:account_statement_import_online.online_bank_statement_provider_action +#: model:ir.ui.menu,name:account_statement_import_online.online_bank_statement_provider_menu +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_filter +msgid "Online Bank Statement Providers" +msgstr "Online Bank afschrift Aanbieders" + +#. module: account_statement_import_online +#: model:ir.model,name:account_statement_import_online.model_online_bank_statement_pull_wizard +msgid "Online Bank Statement Pull Wizard" +msgstr "" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.view_account_journal_form +msgid "Online Bank Statements (OCA)" +msgstr "Online Bank Afschriften (OCA)" + +#. module: account_statement_import_online +#: model:ir.actions.act_window,name:account_statement_import_online.action_online_bank_statements_pull_wizard +msgid "Online Bank Statements Pull Wizard" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.constraint,message:account_statement_import_online.constraint_online_bank_statement_provider_journal_id_uniq +msgid "Only one online banking statement provider per journal!" +msgstr "" +"Er kan slechts een bankafschrift leverancier worden ingesteld per rekening!" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__origin +msgid "Origin" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__passphrase +msgid "Passphrase" +msgstr "wachtwoordzin" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__password +msgid "Password" +msgstr "Wachtwoord" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.view_account_journal_form +msgid "Provider" +msgstr "Leverancier" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_pull_wizard_form +msgid "Pull" +msgstr "Opvragen" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.view_account_journal_form +msgid "Pull Online Bank Statement" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.actions.server,name:account_statement_import_online.ir_cron_account_pull_online_bank_statements_ir_actions_server +#: model:ir.cron,cron_name:account_statement_import_online.ir_cron_account_pull_online_bank_statements +#: model:ir.cron,name:account_statement_import_online.ir_cron_account_pull_online_bank_statements +msgid "Pull Online Bank Statements" +msgstr "Online Bank afschrifte opvragen" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_has_sms_error +msgid "SMS Delivery error" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__account_number +msgid "Sanitized Account Number" +msgstr "Opgeschoond rekeningnummer" + +#. module: account_statement_import_online +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_form +msgid "Scheduled Pull" +msgstr "Geplande opvraag" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__interval_number +msgid "Scheduled update interval" +msgstr "Opvraag interval" + +#. module: account_statement_import_online +#: model:ir.model.constraint,message:account_statement_import_online.constraint_online_bank_statement_provider_valid_interval_number +msgid "Scheduled update interval must be greater than zero!" +msgstr "Planningsinterval moet groter zijn dan 0!" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_account_journal__online_bank_statement_provider_id +msgid "" +"Select the actual instance of a configured provider (a record).\n" +"Selecting a type of provider will automatically create a provider record " +"linked to this journal." +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_account_journal__online_bank_statement_provider +msgid "Select the type of service provider (a model)" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__service +#: model_terms:ir.ui.view,arch_db:account_statement_import_online.online_bank_statement_provider_filter +msgid "Service" +msgstr "Service" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__statement_creation_mode +msgid "Statement Creation Mode" +msgstr "Bankafschrift creatie modus" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_account_journal__online_bank_statement_provider_id +msgid "Statement Provider" +msgstr "Afschrift leverancier" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__currency_id +msgid "The currency used to enter statement" +msgstr "De valuta voor het gebruikte afschrift" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__tz +msgid "Timezone" +msgstr "Tijdzone" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__tz +msgid "" +"Timezone to convert transaction timestamps to prior being saved into a " +"statement." +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_pull_wizard__date_until +msgid "To" +msgstr "" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_unread +msgid "Unread Messages" +msgstr "Ongelezen berichten" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__message_unread_counter +msgid "Unread Messages Counter" +msgstr "Aantal ongelezen berichten" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__update_schedule +msgid "Update Schedule" +msgstr "Update planning" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__username +msgid "Username" +msgstr "Gebruikersnaam" + +#. module: account_statement_import_online +#: model:ir.model.fields,field_description:account_statement_import_online.field_online_bank_statement_provider__website_message_ids +msgid "Website Messages" +msgstr "Website berichten" + +#. module: account_statement_import_online +#: model:ir.model.fields,help:account_statement_import_online.field_online_bank_statement_provider__website_message_ids +msgid "Website communication history" +msgstr "Website berichten geschiedenis" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__interval_type__weeks +msgid "Week(s)" +msgstr "Weken" + +#. module: account_statement_import_online +#: model:ir.model.fields.selection,name:account_statement_import_online.selection__online_bank_statement_provider__statement_creation_mode__weekly +msgid "Weekly statements" +msgstr "Weekelijkse afschriften" + +#~ msgid "Details" +#~ msgstr "Details" + +#~ msgid "Since" +#~ msgstr "sinds" + +#~ msgid "Since (at least)" +#~ msgstr "sinds (ten minste)" + +#~ msgid "Until" +#~ msgstr "Tot" + +#~ msgid "Until (at least)" +#~ msgstr "Tot (ten minste)" diff --git a/account_statement_import_online/models/__init__.py b/account_statement_import_online/models/__init__.py new file mode 100644 index 000000000..56bd827cc --- /dev/null +++ b/account_statement_import_online/models/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import account_journal +from . import online_bank_statement_provider diff --git a/account_statement_import_online/models/account_journal.py b/account_statement_import_online/models/account_journal.py new file mode 100644 index 000000000..472c72a38 --- /dev/null +++ b/account_statement_import_online/models/account_journal.py @@ -0,0 +1,98 @@ +# Copyright 2019-2020 Brainbean Apps (https://brainbeanapps.com) +# Copyright 2019-2020 Dataplug (https://dataplug.io) +# Copyright 2023 Therp BV (https://therp.nl) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +import logging + +from odoo import _, api, fields, models + +_logger = logging.getLogger(__name__) + + +class AccountJournal(models.Model): + _inherit = "account.journal" + + @api.model + def _selection_service(self): + OnlineBankStatementProvider = self.env["online.bank.statement.provider"] + return OnlineBankStatementProvider._get_available_services() + [ + ("dummy", "Dummy") + ] + + # Keep provider fields for compatibility with other modules. + online_bank_statement_provider = fields.Selection( + selection=lambda self: self._selection_service(), + ) + online_bank_statement_provider_id = fields.Many2one( + string="Statement Provider", + comodel_name="online.bank.statement.provider", + copy=False, + ) + + def __get_bank_statements_available_sources(self): + result = super().__get_bank_statements_available_sources() + result.append(("online", _("Online (OCA)"))) + return result + + def _update_providers(self): + """Automatically create service. + + This method exists for compatibility reasons. The preferred method + to create an online provider is directly through the menu, + """ + OnlineBankStatementProvider = self.env["online.bank.statement.provider"] + for journal in self.filtered("online_bank_statement_provider"): + service = journal.online_bank_statement_provider + if ( + journal.online_bank_statement_provider_id + and service == journal.online_bank_statement_provider_id.service + ): + _logger.info( + "Journal %s already linked to service %s", journal.name, service + ) + # Provider already exists. + continue + # Use existing or create new provider for service. + provider = OnlineBankStatementProvider.search( + [ + ("journal_id", "=", journal.id), + ("service", "=", service), + ], + limit=1, + ) or OnlineBankStatementProvider.create( + { + "journal_id": journal.id, + "service": service, + } + ) + journal.online_bank_statement_provider_id = provider + _logger.info("Journal %s now linked to service %s", journal.name, service) + + @api.model_create_multi + def create(self, vals_list): + for vals in vals_list: + self._update_vals(vals) + journals = super().create(vals_list) + journals._update_providers() + return journals + + def write(self, vals): + self._update_vals(vals) + res = super().write(vals) + self._update_providers() + return res + + def _update_vals(self, vals): + """Ensure consistent values.""" + if ( + "bank_statements_source" in vals + and vals.get("bank_statements_source") != "online" + ): + vals["online_bank_statement_provider"] = False + vals["online_bank_statement_provider_id"] = False + + def action_online_bank_statements_pull_wizard(self): + """This method is also kept for compatibility reasons.""" + self.ensure_one() + provider = self.online_bank_statement_provider_id + return provider.action_online_bank_statements_pull_wizard() diff --git a/account_statement_import_online/models/online_bank_statement_provider.py b/account_statement_import_online/models/online_bank_statement_provider.py new file mode 100644 index 000000000..a6e83d3cb --- /dev/null +++ b/account_statement_import_online/models/online_bank_statement_provider.py @@ -0,0 +1,518 @@ +# Copyright 2019-2020 Brainbean Apps (https://brainbeanapps.com) +# Copyright 2019-2020 Dataplug (https://dataplug.io) +# Copyright 2022-2023 Therp BV (https://therp.nl) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +import logging +from datetime import datetime +from decimal import Decimal +from html import escape + +from dateutil.relativedelta import MO, relativedelta +from pytz import timezone, utc + +from odoo import _, api, fields, models + +from odoo.addons.base.models.res_partner import _tz_get + +_logger = logging.getLogger(__name__) + + +class OnlineBankStatementProvider(models.Model): + _name = "online.bank.statement.provider" + _inherit = ["mail.thread"] + _description = "Online Bank Statement Provider" + + company_id = fields.Many2one(related="journal_id.company_id", store=True) + active = fields.Boolean(default=True) + name = fields.Char(compute="_compute_name", store=True) + journal_id = fields.Many2one( + comodel_name="account.journal", + required=True, + ondelete="cascade", + domain=[("type", "=", "bank")], + ) + currency_id = fields.Many2one(related="journal_id.currency_id") + account_number = fields.Char( + related="journal_id.bank_account_id.sanitized_acc_number" + ) + tz = fields.Selection( + selection=_tz_get, + string="Timezone", + default=lambda self: self.env.context.get("tz"), + help=( + "Timezone to convert transaction timestamps to prior being" + " saved into a statement." + ), + ) + service = fields.Selection( + selection=lambda self: self._selection_service(), + required=True, + ) + interval_type = fields.Selection( + selection=[ + ("minutes", "Minute(s)"), + ("hours", "Hour(s)"), + ("days", "Day(s)"), + ("weeks", "Week(s)"), + ], + default="hours", + required=True, + ) + interval_number = fields.Integer( + string="Scheduled update interval", + default=1, + required=True, + ) + update_schedule = fields.Char( + compute="_compute_update_schedule", + ) + last_successful_run = fields.Datetime(string="Last successful pull") + next_run = fields.Datetime( + string="Next scheduled pull", + default=fields.Datetime.now, + required=True, + ) + statement_creation_mode = fields.Selection( + selection=[ + ("daily", "Daily statements"), + ("weekly", "Weekly statements"), + ("monthly", "Monthly statements"), + ], + default="daily", + required=True, + ) + api_base = fields.Char() + origin = fields.Char() + username = fields.Char() + password = fields.Char() + key = fields.Binary() + certificate = fields.Binary() + passphrase = fields.Char() + certificate_public_key = fields.Text() + certificate_private_key = fields.Text() + certificate_chain = fields.Text() + + _sql_constraints = [ + ( + "journal_id_uniq", + "UNIQUE(journal_id)", + "Only one online banking statement provider per journal!", + ), + ( + "valid_interval_number", + "CHECK(interval_number > 0)", + "Scheduled update interval must be greater than zero!", + ), + ] + + @api.model + def create(self, vals): + """Set provider_id on journal after creation.""" + records = super().create(vals) + records._update_journals() + return records + + def write(self, vals): + """Set provider_id on journal after creation.""" + result = super().write(vals) + self._update_journals() + return result + + def _update_journals(self): + """Update journal with this provider. + + This is for compatibility reasons. + """ + for this in self: + this.journal_id.write( + { + "online_bank_statement_provider_id": this.id, + "online_bank_statement_provider": this.service, + "bank_statements_source": "online", + } + ) + + def unlink(self): + """Reset journals.""" + journals = self.mapped("journal_id") + if journals: + vals = { + "bank_statements_source": "undefined", + "online_bank_statement_provider": False, + "online_bank_statement_provider_id": False, + } + journals.write(vals) + result = super().unlink() + return result + + @api.model + def _get_available_services(self): + """Hook for extension""" + return [] + + @api.model + def _selection_service(self): + return self._get_available_services() + [("dummy", "Dummy")] + + @api.model + def values_service(self): + return self._get_available_services() + + @api.depends("service", "journal_id.name") + def _compute_name(self): + """We can have multiple providers/journals for the same service.""" + for provider in self: + provider.name = " ".join([provider.journal_id.name, provider.service]) + + @api.depends("active", "interval_type", "interval_number") + def _compute_update_schedule(self): + for provider in self: + if not provider.active: + provider.update_schedule = _("Inactive") + continue + + provider.update_schedule = _("%(number)s %(type)s") % { + "number": provider.interval_number, + "type": list( + filter( + lambda x: x[0] == provider.interval_type, + self._fields["interval_type"].selection, + ) + )[0][1], + } + + def _pull(self, date_since, date_until): + """Pull data for all providers within requested period.""" + is_scheduled = self.env.context.get("scheduled") + for provider in self: + statement_date_since = provider._get_statement_date_since(date_since) + while statement_date_since < date_until: + # Note that statement_date_until is exclusive, while date_until is + # inclusive. So if we have daily statements date_until might + # be 2020-01-31, while statement_date_until is 2020-02-01. + statement_date_until = ( + statement_date_since + provider._get_statement_date_step() + ) + try: + data = provider._obtain_statement_data( + statement_date_since, statement_date_until + ) + except BaseException as exception: + if not is_scheduled: + raise + provider._log_provider_exception( + exception, statement_date_since, statement_date_until + ) + break # Continue with next provider. + provider._create_or_update_statement( + data, statement_date_since, statement_date_until + ) + statement_date_since = statement_date_until + if is_scheduled: + provider._schedule_next_run() + + def _log_provider_exception( + self, exception, statement_date_since, statement_date_until + ): + """Both log error, and post a message on the provider record.""" + self.ensure_one() + _logger.warning( + _( + 'Online Bank Statement provider "%(name)s" failed to' + " obtain statement data since %(since)s until %(until)s" + ), + dict( + name=self.name, + since=statement_date_since, + until=statement_date_until, + ), + exc_info=True, + ) + self.message_post( + body=_( + "Failed to obtain statement data for period " + "since {since} until {until}: {exception}. See server logs for " + "more details." + ).format( + since=statement_date_since, + until=statement_date_until, + exception=escape(str(exception)) or _("N/A"), + ), + subject=_("Issue with Online Bank Statement self"), + ) + + def _create_or_update_statement( + self, data, statement_date_since, statement_date_until + ): + """Create or update bank statement with the data retrieved from provider. + + We can not use statement.date as a unique key within the statements + of a journal, because this is now a computed field based on the last date in + the statement lines. + + However we can still ensure unique and predictable names, so we wil use that + to find existing statements. + """ + self.ensure_one() + if not data: + data = ([], {}) + unfiltered_lines, statement_values = data + if not unfiltered_lines: + unfiltered_lines = [] + if not statement_values: + statement_values = {} + statement_values["name"] = self.make_statement_name(statement_date_since) + filtered_lines = self._get_statement_filtered_lines( + unfiltered_lines, + statement_values, + statement_date_since, + statement_date_until, + ) + if not filtered_lines: + return self.env["account.bank.statement"] + if filtered_lines: + statement_values.update( + {"line_ids": [[0, False, line] for line in filtered_lines]} + ) + self._update_statement_balances(statement_values) + statement = self._statement_create_or_write(statement_values) + return statement + + def make_statement_name(self, statement_date_since): + """Make name for statement using date and journal name.""" + self.ensure_one() + return "%s/%s" % ( + self.journal_id.code, + statement_date_since.strftime("%Y-%m-%d"), + ) + + def _statement_create_or_write(self, statement_values): + """Final creation of statement if new, else write.""" + AccountBankStatement = self.env["account.bank.statement"] + is_scheduled = self.env.context.get("scheduled") + if is_scheduled: + AccountBankStatement = AccountBankStatement.with_context( + tracking_disable=True, + ) + statement_name = statement_values["name"] + statement = AccountBankStatement.search( + [ + ("journal_id", "=", self.journal_id.id), + ("name", "=", statement_name), + ], + limit=1, + ) + if not statement: + statement_values["journal_id"] = self.journal_id.id + statement = AccountBankStatement.with_context( + journal_id=self.journal_id.id, + ).create(statement_values) + else: + statement.write(statement_values) + return statement + + def _get_statement_filtered_lines( + self, + unfiltered_lines, + statement_values, + statement_date_since, + statement_date_until, + ): + """Get lines from line data, but only for the right date.""" + AccountBankStatementLine = self.env["account.bank.statement.line"] + provider_tz = timezone(self.tz) if self.tz else utc + journal = self.journal_id + speeddict = journal._statement_line_import_speeddict() + filtered_lines = [] + lines_before_since = 0 + lines_after_until = 0 + lines_not_unique = 0 + for line_values in unfiltered_lines: + date = line_values["date"] + if not isinstance(date, datetime): + date = fields.Datetime.from_string(date) + if date.tzinfo is None: + date = date.replace(tzinfo=utc) + date = date.astimezone(utc).replace(tzinfo=None) + if date < statement_date_since: + if "balance_start" in statement_values: + statement_values["balance_start"] = Decimal( + statement_values["balance_start"] + ) + Decimal(line_values["amount"]) + lines_before_since += 1 + continue + elif date >= statement_date_until: + if "balance_end_real" in statement_values: + statement_values["balance_end_real"] = Decimal( + statement_values["balance_end_real"] + ) - Decimal(line_values["amount"]) + lines_after_until += 1 + continue + date = date.replace(tzinfo=utc) + date = date.astimezone(provider_tz).replace(tzinfo=None) + line_values["date"] = date + journal._statement_line_import_update_unique_import_id( + line_values, self.account_number + ) + unique_import_id = line_values.get("unique_import_id") + if unique_import_id: + if AccountBankStatementLine.sudo().search( + [("unique_import_id", "=", unique_import_id)], limit=1 + ): + lines_not_unique += 1 + continue + if not line_values.get("payment_ref"): + line_values["payment_ref"] = line_values.get("ref") + line_values["journal_id"] = self.journal_id.id + journal._statement_line_import_update_hook(line_values, speeddict) + filtered_lines.append(line_values) + if unfiltered_lines: + if len(unfiltered_lines) == len(filtered_lines): + _logger.debug(_("All lines passed filtering")) + else: + _logger.debug( + _( + "Of %(lines_provided)s lines provided" + ", %(before)s where before %(since)s" + ", %(after)s where on or after %(until)s" + "and %(duplicate)s where not unique." + ), + dict( + lines_provided=len(unfiltered_lines), + before=lines_before_since, + since=statement_date_since, + after=lines_after_until, + until=statement_date_until, + duplicate=lines_not_unique, + ), + ) + return filtered_lines + + def _update_statement_balances(self, statement_values): + """Update statement balance_ start/end/end_real.""" + AccountBankStatement = self.env["account.bank.statement"] + if "balance_start" in statement_values: + statement_values["balance_start"] = float(statement_values["balance_start"]) + else: + # Take balance_end of previous statement as start of this one. + previous_statement = AccountBankStatement.search( + [ + ("journal_id", "=", self.journal_id.id), + ("name", "<", statement_values["name"]), + ], + limit=1, + ) + if previous_statement and previous_statement.balance_end: + statement_values["balance_start"] = previous_statement.balance_end + if "balance_end_real" in statement_values: + statement_values["balance_end_real"] = float( + statement_values["balance_end_real"] + ) + + def _schedule_next_run(self): + self.ensure_one() + self.last_successful_run = self.next_run + self.next_run += self._get_next_run_period() + + def _get_statement_date_since(self, date): + self.ensure_one() + date = date.replace(hour=0, minute=0, second=0, microsecond=0) + if self.statement_creation_mode == "daily": + return date + elif self.statement_creation_mode == "weekly": + return date + relativedelta(weekday=MO(-1)) + elif self.statement_creation_mode == "monthly": + return date.replace(day=1) + + def _get_statement_date_step(self): + self.ensure_one() + if self.statement_creation_mode == "daily": + return relativedelta(days=1, hour=0, minute=0, second=0, microsecond=0) + elif self.statement_creation_mode == "weekly": + return relativedelta( + weeks=1, + weekday=MO, + hour=0, + minute=0, + second=0, + microsecond=0, + ) + elif self.statement_creation_mode == "monthly": + return relativedelta( + months=1, + day=1, + hour=0, + minute=0, + second=0, + microsecond=0, + ) + + def _get_next_run_period(self): + self.ensure_one() + if self.interval_type == "minutes": + return relativedelta(minutes=self.interval_number) + elif self.interval_type == "hours": + return relativedelta(hours=self.interval_number) + elif self.interval_type == "days": + return relativedelta(days=self.interval_number) + elif self.interval_type == "weeks": + return relativedelta(weeks=self.interval_number) + + @api.model + def _scheduled_pull(self): + _logger.info(_("Scheduled pull of online bank statements...")) + providers = self.search( + [("active", "=", True), ("next_run", "<=", fields.Datetime.now())] + ) + if providers: + _logger.info( + _("Pulling online bank statements of: %(provider_names)s"), + dict(provider_names=", ".join(providers.mapped("journal_id.name"))), + ) + for provider in providers.with_context( + scheduled=True, tracking_disable=True + ): + provider._adjust_schedule() + date_since = ( + (provider.last_successful_run) + if provider.last_successful_run + else (provider.next_run - provider._get_next_run_period()) + ) + date_until = provider.next_run + provider._pull(date_since, date_until) + _logger.info(_("Scheduled pull of online bank statements complete.")) + + def _adjust_schedule(self): + """Make sure next_run is current. + + Current means adding one more period would put if after the + current moment. This will be done at the end of the run. + The net effect of this method and the adjustment after the run + will be for the next_run to be in the future. + """ + self.ensure_one() + delta = self._get_next_run_period() + now = datetime.now() + next_run = self.next_run + delta + while next_run < now: + self.next_run = next_run + next_run = self.next_run + delta + + def _obtain_statement_data(self, date_since, date_until): + """Hook for extension""" + # Check tests/online_bank_statement_provider_dummy.py for reference + self.ensure_one() + return [] + + def action_online_bank_statements_pull_wizard(self): + self.ensure_one() + WIZARD_MODEL = "online.bank.statement.pull.wizard" + wizard = self.env[WIZARD_MODEL].create([{"provider_ids": [(6, 0, [self.id])]}]) + return { + "type": "ir.actions.act_window", + "res_model": WIZARD_MODEL, + "res_id": wizard.id, + "view_mode": "form", + "target": "new", + } diff --git a/account_statement_import_online/readme/CONFIGURE.rst b/account_statement_import_online/readme/CONFIGURE.rst new file mode 100644 index 000000000..562e6f221 --- /dev/null +++ b/account_statement_import_online/readme/CONFIGURE.rst @@ -0,0 +1,11 @@ +To configure online bank statements provider: + +#. Go to *Invoicing > Configuration > Online Bank Statement Providers* +#. Create a provider and configure provider-specific settings. + +If you want to allow empty bank statements to be created every time the +information is pulled, you can check the option "Allow empty statements" +at the provider configuration level. + +**NOTE**: To access these features, user needs to belong to +*Show Full Accounting Features* group. diff --git a/account_statement_import_online/readme/CONTRIBUTORS.rst b/account_statement_import_online/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..fc2a1a3c6 --- /dev/null +++ b/account_statement_import_online/readme/CONTRIBUTORS.rst @@ -0,0 +1,7 @@ +* `CorporateHub `__ + + * Alexey Pelykh + +* `Therp BV `__ + + * Ronald Portier diff --git a/account_statement_import_online/readme/DESCRIPTION.rst b/account_statement_import_online/readme/DESCRIPTION.rst new file mode 100644 index 000000000..cc0aaaf4c --- /dev/null +++ b/account_statement_import_online/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module provides base for building online bank statements providers. diff --git a/account_statement_import_online/readme/USAGE.rst b/account_statement_import_online/readme/USAGE.rst new file mode 100644 index 000000000..e92a0eb35 --- /dev/null +++ b/account_statement_import_online/readme/USAGE.rst @@ -0,0 +1,9 @@ +To pull historical bank statements: + +#. Go to *Invoicing > Configuration > Online Bank Statement Providers* +#. Select a specific provider +#. Click on *PULL ONLINE BANK STATEMENT* +#. Configure date interval and click *Pull* + +**NOTE**: To access these features, user needs to belong to +*Show Full Accounting Features* group. diff --git a/account_statement_import_online/security/ir.model.access.csv b/account_statement_import_online/security/ir.model.access.csv new file mode 100644 index 000000000..d0856372e --- /dev/null +++ b/account_statement_import_online/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_online_bank_statement_provider_admin,online.bank.statement.provider:base.group_system,model_online_bank_statement_provider,base.group_system,1,1,1,1 +access_online_bank_statement_provider_user,online.bank.statement.provider:account.group_account_user,model_online_bank_statement_provider,account.group_account_user,1,1,1,1 +access_online_bank_statement_pull_wizard_user,online.bank.statement.pull.wizard:account.group_account_user,model_online_bank_statement_pull_wizard,account.group_account_user,1,1,1,1 diff --git a/account_statement_import_online/security/online_bank_statement_provider.xml b/account_statement_import_online/security/online_bank_statement_provider.xml new file mode 100644 index 000000000..db8c82d0a --- /dev/null +++ b/account_statement_import_online/security/online_bank_statement_provider.xml @@ -0,0 +1,15 @@ + + + + + Online Bank Statement Provider multi-company + + ['|',('company_id','=',False),('company_id','in',company_ids)] + + diff --git a/account_statement_import_online/static/description/icon.png b/account_statement_import_online/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/account_statement_import_online/static/description/icon.png differ diff --git a/account_statement_import_online/static/description/index.html b/account_statement_import_online/static/description/index.html new file mode 100644 index 000000000..c47516eab --- /dev/null +++ b/account_statement_import_online/static/description/index.html @@ -0,0 +1,471 @@ + + + + + + +Online Bank Statements + + + +
+

Online Bank Statements

+ + +

Beta License: AGPL-3 OCA/bank-statement-import Translate me on Weblate Try me on Runbot

+

This module provides base for building online bank statements providers.

+

Table of contents

+ +
+

Configuration

+

To configure online bank statements provider:

+
    +
  1. Go to Invoicing > Configuration > Bank Accounts
  2. +
  3. Open bank account to configure and edit it
  4. +
  5. Set Bank Feeds to Online
  6. +
  7. Select online bank statements provider in Online Bank Statements (OCA) +section
  8. +
  9. Save the bank account
  10. +
  11. Click on provider and configure provider-specific settings.
  12. +
+

or, alternatively:

+
    +
  1. Go to Invoicing > Overview
  2. +
  3. Open settings of the corresponding journal account
  4. +
  5. Switch to Bank Account tab
  6. +
  7. Set Bank Feeds to Online
  8. +
  9. Select online bank statements provider in Online Bank Statements (OCA) +section
  10. +
  11. Save the bank account
  12. +
  13. Click on provider and configure provider-specific settings.
  14. +
+

If you want to allow empty bank statements to be created every time the +information is pulled, you can check the option “Allow empty statements” +at the provider configuration level.

+

NOTE: To access these features, user needs to belong to +Show Full Accounting Features group.

+
+
+

Usage

+

To pull historical bank statements:

+
    +
  1. Go to Invoicing > Configuration > Bank Accounts
  2. +
  3. Select specific bank accounts
  4. +
  5. Launch Actions > Online Bank Statements Pull Wizard
  6. +
  7. Configure date interval and click Pull
  8. +
+

NOTE: To access these features, user needs to belong to +Show Full Accounting Features group.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • CorporateHub
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

Current maintainer:

+

alexey-pelykh

+

This module is part of the OCA/bank-statement-import project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_statement_import_online/tests/__init__.py b/account_statement_import_online/tests/__init__.py new file mode 100644 index 000000000..c631b1f09 --- /dev/null +++ b/account_statement_import_online/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import test_account_bank_statement_import_online diff --git a/account_statement_import_online/tests/online_bank_statement_provider_dummy.py b/account_statement_import_online/tests/online_bank_statement_provider_dummy.py new file mode 100644 index 000000000..cb44a7fb7 --- /dev/null +++ b/account_statement_import_online/tests/online_bank_statement_provider_dummy.py @@ -0,0 +1,78 @@ +# Copyright 2019-2020 Brainbean Apps (https://brainbeanapps.com) +# Copyright 2019-2020 Dataplug (https://dataplug.io) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from datetime import datetime, timedelta +from random import randrange + +from dateutil.relativedelta import relativedelta +from pytz import timezone + +from odoo import fields, models + + +class OnlineBankStatementProviderDummy(models.Model): + _inherit = "online.bank.statement.provider" + + def _obtain_statement_data(self, date_since, date_until): + self.ensure_one() + if self.service != "dummy": + return super()._obtain_statement_data( + date_since, + date_until, + ) # pragma: no cover + + if self.env.context.get("crash", False): + exception = self.env.context.get("exception", Exception("Expected")) + raise exception + + line_step_options = self.env.context.get("step", {"minutes": 5}) + line_step = relativedelta(**line_step_options) + expand_by = self.env.context.get("expand_by", 0) + # Override date_since and date_until from context. + override_date_since = self.env.context.get("override_date_since", date_since) + override_date_until = self.env.context.get("override_date_until", date_until) + override_date_since -= expand_by * line_step + override_date_until += expand_by * line_step + + balance_start = self.env.context.get( + "balance_start", randrange(-10000, 10000, 1) * 0.1 + ) + balance = balance_start + + tz = self.env.context.get("tz") + if tz: + tz = timezone(tz) + + timestamp_mode = self.env.context.get("timestamp_mode") + + lines = [] + date = override_date_since + while date < override_date_until: + amount = self.env.context.get("amount", randrange(-100, 100, 1) * 0.1) + transaction_date = date.replace(tzinfo=tz) + if timestamp_mode == "date": + transaction_date = transaction_date.date() + elif timestamp_mode == "str": + transaction_date = fields.Datetime.to_string(transaction_date) + lines.append( + { + "payment_ref": "payment", + "amount": amount, + "date": transaction_date, + "unique_import_id": str( + int((date - datetime(1970, 1, 1)) / timedelta(seconds=1)) + ), + "partner_name": "John Doe", + "account_number": "XX00 0000 0000 0000", + } + ) + balance += amount + date += line_step + balance_end = balance + statement = {} + if self.env.context.get("balance", True): + statement.update( + {"balance_start": balance_start, "balance_end_real": balance_end} + ) + return lines, statement diff --git a/account_statement_import_online/tests/test_account_bank_statement_import_online.py b/account_statement_import_online/tests/test_account_bank_statement_import_online.py new file mode 100644 index 000000000..26ac1c58d --- /dev/null +++ b/account_statement_import_online/tests/test_account_bank_statement_import_online.py @@ -0,0 +1,428 @@ +# Copyright 2019-2020 Brainbean Apps (https://brainbeanapps.com) +# Copyright 2019-2020 Dataplug (https://dataplug.io) +# Copyright 2022-2023 Therp BV (https://therp.nl) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import logging +from datetime import date, datetime +from unittest import mock +from urllib.error import HTTPError + +from dateutil.relativedelta import relativedelta +from odoo_test_helper import FakeModelLoader + +from odoo import _, fields +from odoo.tests import common + +_logger = logging.getLogger(__name__) + +mock_obtain_statement_data = ( + "odoo.addons.account_statement_import_online.tests." + + "online_bank_statement_provider_dummy.OnlineBankStatementProviderDummy." + + "_obtain_statement_data" +) + + +class TestAccountBankAccountStatementImportOnline(common.TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + + # Load fake model + cls.loader = FakeModelLoader(cls.env, cls.__module__) + cls.loader.backup_registry() + cls.addClassCleanup(cls.loader.restore_registry) + from .online_bank_statement_provider_dummy import ( + OnlineBankStatementProviderDummy, + ) + + cls.loader.update_registry((OnlineBankStatementProviderDummy,)) + + cls.now = fields.Datetime.now() + cls.AccountAccount = cls.env["account.account"] + cls.AccountJournal = cls.env["account.journal"] + cls.OnlineBankStatementProvider = cls.env["online.bank.statement.provider"] + cls.OnlineBankStatementPullWizard = cls.env["online.bank.statement.pull.wizard"] + cls.AccountBankStatement = cls.env["account.bank.statement"] + cls.AccountBankStatementLine = cls.env["account.bank.statement.line"] + + cls.journal = cls.AccountJournal.create( + { + "name": "Bank", + "type": "bank", + "code": "BANK", + "bank_statements_source": "online", + } + ) + cls.provider = cls.OnlineBankStatementProvider.create( + { + "name": "Dummy Provider", + "service": "dummy", + "journal_id": cls.journal.id, + "statement_creation_mode": "daily", + } + ) + + def test_pull_mode_daily(self): + self.provider.statement_creation_mode = "daily" + self.provider.with_context(step={"hours": 2})._pull( + self.now - relativedelta(days=1), + self.now, + ) + self._getExpectedStatements(2) + + def test_pull_mode_weekly(self): + self.provider.statement_creation_mode = "weekly" + self.provider.with_context(step={"hours": 8})._pull( + self.now - relativedelta(weeks=1), + self.now, + ) + self._getExpectedStatements(2) + + def test_pull_mode_monthly(self): + self.provider.statement_creation_mode = "monthly" + self.provider.with_context(step={"hours": 8})._pull( + self.now - relativedelta(months=1), + self.now, + ) + self._getExpectedStatements(2) + + def test_pull_scheduled(self): + self.provider.next_run = self.now - relativedelta(days=15) + self._getExpectedStatements(0) + self.provider.with_context(step={"hours": 8})._scheduled_pull() + self._getExpectedStatements(1) + + def test_pull_skip_duplicates_by_unique_import_id(self): + self.provider.statement_creation_mode = "weekly" + # Get for two weeks of data. + self.provider.with_context( + step={"hours": 8}, + override_date_since=self.now - relativedelta(weeks=2), + override_date_until=self.now, + )._pull( + self.now - relativedelta(weeks=2), + self.now, + ) + expected_count = 14 * (24 / 8) + self._getExpectedLines(expected_count) + # Get two weeks, but one overlapping with previous. + self.provider.with_context( + step={"hours": 8}, + override_date_since=self.now - relativedelta(weeks=3), + override_date_until=self.now - relativedelta(weeks=1), + )._pull( + self.now - relativedelta(weeks=3), + self.now - relativedelta(weeks=1), + ) + expected_count = 21 * (24 / 8) + self._getExpectedLines(expected_count) + # Get another day, but within statements already retrieved. + self.provider.with_context( + step={"hours": 8}, + override_date_since=self.now - relativedelta(weeks=1), + override_date_until=self.now, + )._pull( + self.now - relativedelta(weeks=1), + self.now, + ) + self._getExpectedLines(expected_count) + + def test_interval_type_minutes(self): + self.provider.interval_type = "minutes" + self.provider._compute_update_schedule() + + def test_interval_type_hours(self): + self.provider.interval_type = "hours" + self.provider._compute_update_schedule() + + def test_interval_type_days(self): + self.provider.interval_type = "days" + self.provider._compute_update_schedule() + + def test_interval_type_weeks(self): + self.provider.interval_type = "weeks" + self.provider._compute_update_schedule() + + def test_pull_no_crash(self): + self.provider.statement_creation_mode = "weekly" + self.provider.with_context(crash=True, scheduled=True)._pull( + self.now - relativedelta(hours=1), + self.now, + ) + self._getExpectedStatements(0) + + def test_pull_crash(self): + self.provider.statement_creation_mode = "weekly" + with self.assertRaisesRegex(Exception, "Expected"): + self.provider.with_context(crash=True)._pull( + self.now - relativedelta(hours=1), + self.now, + ) + + def test_pull_httperror(self): + self.provider.statement_creation_mode = "weekly" + with self.assertRaises(HTTPError): + self.provider.with_context( + crash=True, + exception=HTTPError(None, 500, "Error", None, None), + )._pull( + self.now - relativedelta(hours=1), + self.now, + ) + + def test_pull_no_balance(self): + self.provider.with_context( + step={"hours": 2}, + balance_start=0, + amount=100.0, + balance=False, + )._pull( + self.now - relativedelta(days=1), + self.now, + ) + statements = self._getExpectedStatements(2) + self.assertFalse(statements[0].balance_start) + self.assertTrue(statements[0].balance_end) + self.assertTrue(statements[1].balance_start) + + def test_wizard(self): + vals = { + "date_since": self.now - relativedelta(hours=1), + "date_until": self.now, + } + wizard = self.OnlineBankStatementPullWizard.with_context( + active_model=self.provider._name, active_id=self.provider.id + ).create(vals) + wizard.action_pull() + self._getExpectedStatements(1) + + def test_wizard_on_journal(self): + vals = { + "date_since": self.now - relativedelta(hours=1), + "date_until": self.now, + } + wizard = self.OnlineBankStatementPullWizard.with_context( + active_model=self.journal._name, active_id=self.journal.id + ).create(vals) + wizard.action_pull() + self._getExpectedStatements(1) + + def test_pull_statement_partially(self): + self.provider.statement_creation_mode = "monthly" + provider_context = { + "step": {"hours": 24}, + "override_date_since": datetime(2020, 1, 1), + "amount": 1.0, + "balance_start": 0, + } + # Should create statement for first 30 days of january. + self.provider.with_context( + **provider_context, + override_date_until=datetime(2020, 1, 31), + )._pull( + datetime(2020, 1, 1), + datetime(2020, 1, 31), + ) + statements = self._getExpectedStatements(1) + self.assertEqual(statements[0].balance_start, 0.0) + self.assertEqual(statements[0].balance_end_real, 30.0) + # Should create statement for first 14 days of february, + # and add one line to statement for january. + self.provider.with_context( + **provider_context, + override_date_until=datetime(2020, 2, 15), + )._pull( + datetime(2020, 1, 1), + datetime(2020, 2, 29), + ) + statements = self._getExpectedStatements(2) + self.assertEqual(statements[0].balance_start, 0.0) + self.assertEqual(statements[0].balance_end_real, 31.0) + self.assertEqual(statements[1].balance_start, 31.0) + self.assertEqual(statements[1].balance_end_real, 45.0) + # Getting data for rest of februari should not create new statement. + self.provider.with_context( + **provider_context, + override_date_until=datetime(2020, 2, 29), + )._pull( + datetime(2020, 1, 1), + datetime(2020, 2, 29), + ) + statements = self._getExpectedStatements(2) + self.assertEqual(statements[0].balance_start, 0.0) + self.assertEqual(statements[0].balance_end_real, 31.0) + self.assertEqual(statements[1].balance_start, 31.0) + self.assertEqual(statements[1].balance_end_real, 59.0) + + def test_tz_utc(self): + self.provider.tz = "UTC" + self.provider.with_context( + step={"hours": 1}, + override_date_since=datetime(2020, 4, 17, 22, 0), + override_date_until=datetime(2020, 4, 18, 2, 0), + tz="UTC", + )._pull( + datetime(2020, 4, 17, 22, 0), + datetime(2020, 4, 18, 2, 0), + ) + statements = self._getExpectedStatements(2) + lines = statements.mapped("line_ids").sorted(key=lambda r: r.id) + self.assertEqual(len(lines), 4) + self.assertEqual(lines[0].date, date(2020, 4, 17)) + self.assertEqual(lines[1].date, date(2020, 4, 17)) + self.assertEqual(lines[2].date, date(2020, 4, 18)) + self.assertEqual(lines[3].date, date(2020, 4, 18)) + + def test_tz_non_utc(self): + """Test situation where the provider is west of Greenwich. + + In this case, when it is 22:00 according to the provider, it is + 00:00 the next day according to GMT/UTZ. + """ + self.provider.tz = "Etc/GMT-2" + self.provider.with_context( + step={"hours": 1}, + override_date_since=datetime(2020, 4, 17, 22, 0), + override_date_until=datetime(2020, 4, 18, 2, 0), + tz="UTC", + )._pull( + datetime(2020, 4, 17, 22, 0), + datetime(2020, 4, 18, 2, 0), + ) + statements = self._getExpectedStatements(2) + lines = statements.mapped("line_ids").sorted(key=lambda r: r.id) + self.assertEqual(len(lines), 4) + self.assertEqual(lines[0].date, date(2020, 4, 18)) + self.assertEqual(lines[1].date, date(2020, 4, 18)) + self.assertEqual(lines[2].date, date(2020, 4, 18)) + self.assertEqual(lines[3].date, date(2020, 4, 18)) + + def test_other_tz_to_utc(self): + """Test the situation where we are tot the west of the provider. + + Provider will be GMT/UTC, we will be two hours to the west. + When we pull data from 22:00 on the 17th of april, for + the provider this will be from 00:00 on the 18th. + + We will translate the provider times back to our time. + """ + self.provider.with_context( + step={"hours": 1}, + tz="Etc/GMT-2", + override_date_since=datetime(2020, 4, 18, 0, 0), + override_date_until=datetime(2020, 4, 18, 4, 0), + )._pull( + datetime(2020, 4, 17, 22, 0), + datetime(2020, 4, 18, 2, 0), + ) + statements = self._getExpectedStatements(2) + lines = statements.mapped("line_ids").sorted(key=lambda r: r.id) + self.assertEqual(len(lines), 4) + self.assertEqual(lines[0].date, date(2020, 4, 17)) + self.assertEqual(lines[1].date, date(2020, 4, 17)) + self.assertEqual(lines[2].date, date(2020, 4, 18)) + self.assertEqual(lines[3].date, date(2020, 4, 18)) + + def test_timestamp_date_only_date(self): + self.provider.with_context(step={"hours": 1}, timestamp_mode="date")._pull( + datetime(2020, 4, 18, 0, 0), + datetime(2020, 4, 18, 4, 0), + ) + statements = self._getExpectedStatements(1) + lines = statements.line_ids + self.assertEqual(len(lines), 24) + for line in lines: + self.assertEqual(line.date, date(2020, 4, 18)) + + def test_timestamp_date_only_str(self): + self.provider.with_context( + step={"hours": 1}, + override_date_since=datetime(2020, 4, 18, 0, 0), + override_date_until=datetime(2020, 4, 18, 4, 0), + timestamp_mode="str", + )._pull( + datetime(2020, 4, 18, 0, 0), + datetime(2020, 4, 18, 4, 0), + ) + statements = self._getExpectedStatements(1) + lines = statements.line_ids + self.assertEqual(len(lines), 4) + self.assertEqual(lines[0].date, date(2020, 4, 18)) + self.assertEqual(lines[1].date, date(2020, 4, 18)) + self.assertEqual(lines[2].date, date(2020, 4, 18)) + self.assertEqual(lines[3].date, date(2020, 4, 18)) + + def _get_statement_line_data(self, statement_date): + return [ + { + "payment_ref": "payment", + "amount": 100, + "date": statement_date, + "unique_import_id": str(statement_date), + "partner_name": "John Doe", + "account_number": "XX00 0000 0000 0000", + } + ], {} + + def test_dont_create_empty_statements(self): + """Test the default behavior of not creating empty bank + statements ('Allow empty statements' field is uncheck at the + provider level.). + """ + with mock.patch(mock_obtain_statement_data) as mock_data: + mock_data.side_effect = [ + self._get_statement_line_data(date(2021, 8, 10)), + ([], {}), # August 8th, doesn't have statement + ([], {}), # August 9th, doesn't have statement + self._get_statement_line_data(date(2021, 8, 13)), + ] + self.provider._pull(datetime(2021, 8, 10), datetime(2021, 8, 14)) + statements = self._getExpectedStatements(2) + self.assertEqual(statements[0].balance_start, 0) + self.assertEqual(statements[0].balance_end, 100) + self.assertEqual(len(statements[0].line_ids), 1) + self.assertEqual(statements[1].balance_start, 100) + self.assertEqual(statements[1].balance_end, 200) + self.assertEqual(len(statements[1].line_ids), 1) + + def test_unlink_provider(self): + """Unlink provider should clear fields on journal.""" + self.provider.unlink() + self.assertEqual(self.journal.bank_statements_source, "undefined") + self.assertEqual(self.journal.online_bank_statement_provider, False) + self.assertEqual(self.journal.online_bank_statement_provider_id.id, False) + + def _getExpectedStatements(self, expected_length): + """Check for length of statement recordset, with helpfull logging.""" + statements = self.AccountBankStatement.search( + [("journal_id", "=", self.journal.id)], order="date asc" + ) + actual_length = len(statements) + # If length not expected, log information about statements. + if actual_length != expected_length: + if actual_length == 0: + _logger.warning( + _("No statements found in journal"), + ) + else: + _logger.warning( + _("Names and dates for statements found: %(statements)s"), + dict( + statements=", ".join( + ["%s - %s" % (stmt.name, stmt.date) for stmt in statements] + ) + ), + ) + # Now do the normal assert. + self.assertEqual(len(statements), expected_length) + # If we got expected number, return them. + return statements + + def _getExpectedLines(self, expected_length): + """Check number of lines created.""" + lines = self.AccountBankStatementLine.search( + [("journal_id", "=", self.journal.id)] + ) + self.assertEqual(len(lines), expected_length) + # If we got expected number, return them. + return lines diff --git a/account_statement_import_online/views/account_journal.xml b/account_statement_import_online/views/account_journal.xml new file mode 100644 index 000000000..7d32808d3 --- /dev/null +++ b/account_statement_import_online/views/account_journal.xml @@ -0,0 +1,63 @@ + + + + + account.journal.form + account.journal + + + + + + + +