Browse Source

Merge PR #488 into 12.0

Signed-off-by alexey-pelykh
12.0
OCA-git-bot 2 years ago
parent
commit
4bfa1c1987
  1. 19
      .copier-answers.yml
  2. 4
      .editorconfig
  3. 11
      .flake8
  4. 37
      .github/workflows/pre-commit.yml
  5. 69
      .github/workflows/stale.yml
  6. 69
      .github/workflows/test.yml
  7. 18
      .gitignore
  8. 60
      .pre-commit-config.yaml
  9. 156
      .pylintrc
  10. 68
      .pylintrc-mandatory
  11. 41
      .travis.yml
  12. 12
      LICENSE
  13. 64
      README.md
  14. 2
      account_bank_statement_import_ofx/__manifest__.py
  15. 2
      account_bank_statement_import_online/__manifest__.py
  16. 2
      account_bank_statement_import_online_paypal/__manifest__.py
  17. 244
      account_bank_statement_import_online_paypal/tests/test_account_bank_statement_import_online_paypal.py
  18. 2
      account_bank_statement_import_online_transferwise/__manifest__.py
  19. 1
      account_bank_statement_import_save_file/__manifest__.py
  20. 2
      account_bank_statement_import_split/__manifest__.py
  21. 4
      requirements.txt

19
.copier-answers.yml

@ -0,0 +1,19 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: v1.7.0
_src_path: git+https://github.com/oca/oca-addons-repo-template
ci: GitHub
dependency_installation_mode: PIP
generate_requirements_txt: true
include_wkhtmltopdf: false
odoo_version: 12.0
org_name: Odoo Community Association (OCA)
org_slug: OCA
rebel_module_groups: []
repo_description: This repository hosts additionnal parsers and import features for
bank statements.
repo_name: OCA bank statement import modules for Odoo
repo_slug: bank-statement-import
repo_website: https://github.com/OCA/bank-statement-import
travis_apt_packages: []
travis_apt_sources: []

4
.editorconfig

@ -7,11 +7,11 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[.eslintrc,*.{json,yml,yaml,rst,md}]
[*.{json,yml,yaml,rst,md}]
indent_size = 2
# Do not configure editor for libs and autogenerated content
[*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst]
[{*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst}]
charset = unset
end_of_line = unset
indent_size = unset

11
.flake8

@ -0,0 +1,11 @@
[flake8]
# E123,E133,E226,E241,E242 are ignored by default by pep8 and flake8
# F811 is legal in odoo 8 when we implement 2 interfaces for a method
# F601 pylint support this case with expected tests
# W503 changed by W504 and OCA prefers allow both
# E203: whitespace before ':' (black behaviour and not pep8 compliant)
ignore = E123,E133,E226,E241,E242,F811,F601,W503,W504,E203
max-line-length = 88
per-file-ignores=
__init__.py:F401

37
.github/workflows/pre-commit.yml

@ -0,0 +1,37 @@
name: pre-commit
on:
pull_request:
branches:
- "12.0*"
push:
branches:
- "12.0"
- "12.0-ocabot-*"
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.6"
- name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure --color=always
- name: Check that all files generated by pre-commit are in git
run: |
newfiles="$(git ls-files --others --exclude-from=.gitignore)"
if [ "$newfiles" != "" ] ; then
echo "Please check-in the following files:"
echo "$newfiles"
exit 1
fi

69
.github/workflows/stale.yml

@ -0,0 +1,69 @@
name: Mark stale issues and pull requests
on:
schedule:
- cron: "0 12 * * 0"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- name: Stale PRs and issues policy
uses: actions/stale@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# General settings.
ascending: true
remove-stale-when-updated: true
# Pull Requests settings.
# 120+30 day stale policy for PRs
# * Except PRs marked as "no stale"
days-before-pr-stale: 120
days-before-pr-close: 30
exempt-pr-labels: "no stale"
stale-pr-label: "stale"
stale-pr-message: >
There hasn't been any activity on this pull request in the past 4 months, so
it has been marked as stale and it will be closed automatically if no
further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply
the "no stale" label.
# Issues settings.
# 180+30 day stale policy for open issues
# * Except Issues marked as "no stale"
days-before-issue-stale: 180
days-before-issue-close: 30
exempt-issue-labels: "no stale,needs more information"
stale-issue-label: "stale"
stale-issue-message: >
There hasn't been any activity on this issue in the past 6 months, so it has
been marked as stale and it will be closed automatically if no further
activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to
apply the "no stale" label.
# 15+30 day stale policy for issues pending more information
# * Issues that are pending more information
# * Except Issues marked as "no stale"
- name: Needs more information stale issues policy
uses: actions/stale@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
ascending: true
only-labels: "needs more information"
exempt-issue-labels: "no stale"
days-before-stale: 15
days-before-close: 30
days-before-pr-stale: -1
days-before-pr-close: -1
remove-stale-when-updated: true
stale-issue-label: "stale"
stale-issue-message: >
This issue needs more information and there hasn't been any activity
recently, so it has been marked as stale and it will be closed automatically
if no further activity occurs in the next 30 days.
If you think this is a mistake, please ask a PSC member to remove the "needs
more information" label.

69
.github/workflows/test.yml

@ -0,0 +1,69 @@
name: tests
on:
pull_request:
branches:
- "12.0*"
push:
branches:
- "12.0"
- "12.0-ocabot-*"
jobs:
unreleased-deps:
runs-on: ubuntu-latest
name: Detect unreleased dependencies
steps:
- uses: actions/checkout@v2
- run: |
for reqfile in requirements.txt test-requirements.txt ; do
if [ -f ${reqfile} ] ; then
result=0
# reject non-comment lines that contain a / (i.e. URLs, relative paths)
grep "^[^#].*/" ${reqfile} || result=$?
if [ $result -eq 0 ] ; then
echo "Unreleased dependencies found in ${reqfile}."
exit 1
fi
fi
done
test:
runs-on: ubuntu-latest
container: ${{ matrix.container }}
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- container: ghcr.io/oca/oca-ci/py3.6-odoo12.0:latest
makepot: "true"
name: test with Odoo
- container: ghcr.io/oca/oca-ci/py3.6-ocb12.0:latest
name: test with OCB
services:
postgres:
image: postgres:9.6
env:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
POSTGRES_DB: odoo
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: Install addons and dependencies
run: oca_install_addons
- name: Check licenses
run: manifestoo -d . check-licenses
- name: Check development status
run: manifestoo -d . check-dev-status --default-dev-status=Beta
- name: Initialize test db
run: oca_init_test_database
- name: Run tests
run: oca_run_tests
- uses: codecov/codecov-action@v1
- name: Update .pot files
run: oca_export_and_push_pot https://x-access-token:${{ secrets.GIT_PUSH_TOKEN }}@github.com/${{ github.repository }}
if: ${{ matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == 'OCA' }}

18
.gitignore

@ -1,6 +1,8 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
/.venv
/.pytest_cache
# C extensions
*.so
@ -41,6 +43,19 @@ coverage.xml
# Pycharm
.idea
# Eclipse
.settings
# Visual Studio cache/options directory
.vs/
.vscode
# OSX Files
.DS_Store
# Django stuff:
*.log
# Mr Developer
.mr.developer.cfg
.project
@ -55,3 +70,6 @@ docs/_build/
# Backup files
*~
*.swp
# OCA rules
!static/lib/

60
.pre-commit-config.yaml

@ -0,0 +1,60 @@
exclude: |
(?x)
# NOT INSTALLABLE ADDONS
# END NOT INSTALLABLE ADDONS
# Files and folders generated by bots, to avoid loops
^setup/|/static/description/index\.html$|
# We don't want to mess with tool-generated files
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|
# Maybe reactivate this when all README files include prettier ignore tags?
^README\.md$|
# Library files can have extraneous formatting (even minimized)
/static/(src/)?lib/|
# Repos using Sphinx to generate docs don't need prettying
^docs/_templates/.*\.html$|
# You don't usually want a bot to modify your legal texts
(LICENSE.*|COPYING.*)
default_language_version:
python: python3
repos:
- repo: https://github.com/oca/maintainer-tools
rev: ab1d7f6
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
- id: oca-fix-manifest-website
args: ["https://github.com/OCA/bank-statement-import"]
- repo: https://github.com/acsone/setuptools-odoo
rev: 3.0.6
hooks:
- id: setuptools-odoo-make-default
- id: setuptools-odoo-get-requirements
args:
- --output
- requirements.txt
- --header
- "# generated from manifests external_dependencies"
- repo: https://github.com/OCA/mirrors-flake8
rev: v3.4.1
hooks:
- id: flake8
language_version: python3.6
name: flake8 excluding __init__.py
exclude: __init__\.py
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.5.3
hooks:
- id: pylint
name: pylint with optional checks
args:
- --rcfile=.pylintrc
- --exit-zero
verbose: true
additional_dependencies: &pylint_deps
- pylint-odoo==3.5.0
- id: pylint
name: pylint with mandatory checks
args:
- --rcfile=.pylintrc-mandatory
additional_dependencies: *pylint_deps

156
.pylintrc

@ -0,0 +1,156 @@
[MASTER]
load-plugins=pylint_odoo
score=n
[ODOOLINT]
readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest_required_authors=Odoo Community Association (OCA)
manifest_required_keys=license
manifest_deprecated_keys=description,active
license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
valid_odoo_versions=12.0
[MESSAGES CONTROL]
disable=all
# Enable message and code:
# anomalous-backslash-in-string - W1401
# assignment-from-none - W1111
# dangerous-default-value - W0102
# duplicate-key - W0109
# missing-import-error - W7935
# missing-manifest-dependency - W7936
# pointless-statement - W0104
# pointless-string-statement - W0105
# print-statement - E1601
# redundant-keyword-arg - E1124
# reimported - W0404
# relative-import - W0403
# return-in-init - E0101
# rst-syntax-error - E7901
# too-few-format-args - E1306
# unreachable - W0101
# This .pylintrc contains optional AND mandatory checks and is meant to be
# loaded in an IDE to have it check everything, in the hope this will make
# optional checks more visible to contributors who otherwise never look at a
# green travis to see optional checks that failed.
# .pylintrc-mandatory containing only mandatory checks is used the pre-commit
# config as a blocking check.
# Beta message and code:
# api-one-deprecated - W8104
# api-one-multi-together - W8101
# attribute-deprecated - W8105
# class-camelcase - C8104
# create-user-wo-reset-password - W7905
# consider-merging-classes-inherited - R7980
# copy-wo-api-one - W8102
# dangerous-filter-wo-user - W7901
# dangerous-view-replace-wo-priority - W7940
# deprecated-module - W0402
# duplicate-id-csv - W7906
# duplicate-xml-fields - W7907
# duplicate-xml-record-id - W7902
# file-not-used - W7930
# incoherent-interpreter-exec-perm - W8201
# invalid-commit - E8102
# javascript-lint - W7903
# manifest-deprecated-key - C8103
# method-compute - C8108
# method-inverse - C8110
# method-required-super - W8106
# method-search - C8109
# missing-newline-extrafiles - W7908
# missing-readme - C7902
# no-utf8-coding-comment - C8201
# unnecessary-utf8-coding-comment - C8202
# odoo-addons-relative-import - W7950
# old-api7-method-defined - R8110
# openerp-exception-warning - R8101
# redundant-modulename-xml - W7909
# sql-injection - E8103
# too-complex - C0901
# translation-field - W8103
# translation-required - C8107
# use-vim-comment - W8202
# wrong-tabs-instead-of-spaces - W7910
# xml-syntax-error - E7902
enable=anomalous-backslash-in-string,
assignment-from-none,
dangerous-default-value,
development-status-allowed,
duplicate-key,
duplicate-po-message-definition,
missing-import-error,
missing-manifest-dependency,
po-msgstr-variables,
po-syntax-error,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
too-few-format-args,
unreachable,
eval-used,
eval-referenced,
license-allowed,
manifest-author-string,
manifest-required-author,
manifest-required-key,
manifest-version-format,
api-one-deprecated,
api-one-multi-together,
attribute-deprecated,
class-camelcase,
create-user-wo-reset-password,
consider-merging-classes-inherited,
copy-wo-api-one,
dangerous-filter-wo-user,
dangerous-view-replace-wo-priority,
deprecated-module,
duplicate-id-csv,
duplicate-po-message-definition,
duplicate-xml-fields,
duplicate-xml-record-id,
file-not-used,
incoherent-interpreter-exec-perm,
invalid-commit,
javascript-lint,
manifest-deprecated-key,
method-compute,
method-inverse,
method-required-super,
method-search,
missing-newline-extrafiles,
missing-readme,
po-msgstr-variables,
po-syntax-error,
no-utf8-coding-comment,
unnecessary-utf8-coding-comment,
odoo-addons-relative-import,
old-api7-method-defined,
openerp-exception-warning,
redefined-builtin,
redundant-modulename-xml,
sql-injection,
too-complex,
translation-field,
translation-required,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
output-format=colorized
reports=no

68
.pylintrc-mandatory

@ -0,0 +1,68 @@
[MASTER]
load-plugins=pylint_odoo
score=n
[ODOOLINT]
readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest_required_authors=Odoo Community Association (OCA)
manifest_required_keys=license
manifest_deprecated_keys=description,active
license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
valid_odoo_versions=12.0
[MESSAGES CONTROL]
disable=all
# Enable message and code:
# anomalous-backslash-in-string - W1401
# assignment-from-none - W1111
# dangerous-default-value - W0102
# duplicate-key - W0109
# missing-import-error - W7935
# missing-manifest-dependency - W7936
# pointless-statement - W0104
# pointless-string-statement - W0105
# print-statement - E1601
# redundant-keyword-arg - E1124
# reimported - W0404
# relative-import - W0403
# return-in-init - E0101
# rst-syntax-error - E7901
# too-few-format-args - E1306
# unreachable - W0101
enable=anomalous-backslash-in-string,
assignment-from-none,
dangerous-default-value,
development-status-allowed,
duplicate-key,
duplicate-po-message-definition,
missing-import-error,
missing-manifest-dependency,
po-msgstr-variables,
po-syntax-error,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
too-few-format-args,
unreachable,
eval-used,
eval-referenced,
license-allowed,
manifest-author-string,
manifest-required-author,
manifest-required-key,
manifest-version-format
[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
output-format=colorized
reports=no

41
.travis.yml

@ -1,41 +0,0 @@
language: python
python:
- "3.5"
sudo: false
cache: pip
addons:
postgresql: "9.6"
apt:
packages:
- expect-dev # provides unbuffer utility
- python-lxml # because pip installation is slow
env:
global:
- VERSION="12.0" TESTS="0" LINT_CHECK="0" TRANSIFEX="0"
- TRANSIFEX_USER='transbot@odoo-community.org'
- secure: "G39Lpe4r3QDkivRJrcIX+JDsji/zc+wXrcQ0i2X4L66wrOEcG+SU8Lzp57Odyq+Li7lRa0XQ6rxq7+40Lm4EIoumsYbddp2VjgiR0Bkv8xHOQ2hdrODWbl0ZKhWWpzwGkPs90i39fnFKbPd86XjcvYbPmdapQ/vpUO7ht8WxCRM="
matrix:
- LINT_CHECK="1"
- TRANSIFEX="1"
- TESTS="1" ODOO_REPO="OCA/OCB"
- TESTS="1" ODOO_REPO="odoo/odoo"
install:
- git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- pip install git+https://github.com/jseutter/ofxparse.git
- travis_install_nightly
# example: dependency
# - git clone https://github.com/OCA/webkit-tools -b ${VERSION} $HOME/webkit-tools
script:
- travis_run_tests
after_success:
- travis_after_tests_success

12
LICENSE

@ -1,7 +1,7 @@
GNU AFFERO GENERAL PUBLIC LICENSE
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -633,8 +633,8 @@ the "copyright" line and a pointer to where the full notice is found.
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@ -643,7 +643,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
@ -658,4 +658,4 @@ specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.

64
README.md

@ -1,23 +1,55 @@
[![Build Status](https://travis-ci.org/OCA/bank-statement-import.svg?branch=12.0)](https://travis-ci.org/OCA/bank-statement-import)
[![Coverage Status](https://coveralls.io/repos/OCA/bank-statement-import/badge.svg?branch=12.0)](https://coveralls.io/r/OCA/bank-statement-import?branch=12.0)
OCA bank statement import modules for Odoo
==========================================
[![Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)](https://runboat.odoo-community.org/builds?repo=OCA/bank-statement-import&target_branch=12.0)
[![Pre-commit Status](https://github.com/OCA/bank-statement-import/actions/workflows/pre-commit.yml/badge.svg?branch=12.0)](https://github.com/OCA/bank-statement-import/actions/workflows/pre-commit.yml?query=branch%3A12.0)
[![Build Status](https://github.com/OCA/bank-statement-import/actions/workflows/test.yml/badge.svg?branch=12.0)](https://github.com/OCA/bank-statement-import/actions/workflows/test.yml?query=branch%3A12.0)
[![codecov](https://codecov.io/gh/OCA/bank-statement-import/branch/12.0/graph/badge.svg)](https://codecov.io/gh/OCA/bank-statement-import)
[![Translation Status](https://translation.odoo-community.org/widgets/bank-statement-import-12-0/-/svg-badge.svg)](https://translation.odoo-community.org/engage/bank-statement-import-12-0/?utm_source=widget)
This repository hosts additionnal parsers and import features inspired by v7.0 branch from https://github.com/OCA/bank-payment and https://github.com/OCA/bank-statement-reconcile
<!-- /!\ do not modify above this line -->
Contributing
------------
Do you want to contribute? Please read our [contributing guidelines](https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md).
# OCA bank statement import modules for Odoo
Translation Status
------------------
[![Transifex Status](https://www.transifex.com/projects/p/OCA-bank-statement-import-12-0/chart/image_png)](https://www.transifex.com/projects/p/OCA-bank-statement-import-12-0)
This repository hosts additionnal parsers and import features for bank statements.
----
<!-- /!\ do not modify below this line -->
<!-- prettier-ignore-start -->
[//]: # (addons)
Available addons
----------------
addon | version | maintainers | summary
--- | --- | --- | ---
[account_bank_statement_clear_partner](account_bank_statement_clear_partner/) | 12.0.1.0.0 | | Clear all partners in bank statement lines
[account_bank_statement_import_bypass_check](account_bank_statement_import_bypass_check/) | 12.0.1.0.0 | | Allow possibility to bypass check in Bank statement import
[account_bank_statement_import_camt_oca](account_bank_statement_import_camt_oca/) | 12.0.1.0.1 | | CAMT Format Bank Statements Import
[account_bank_statement_import_move_line](account_bank_statement_import_move_line/) | 12.0.1.0.0 | [![pedrobaeza](https://github.com/pedrobaeza.png?size=30px)](https://github.com/pedrobaeza) | Import journal items into bank statement
[account_bank_statement_import_ofx](account_bank_statement_import_ofx/) | 12.0.1.1.0 | | Import OFX Bank Statement
[account_bank_statement_import_online](account_bank_statement_import_online/) | 12.0.1.5.2 | [![alexey-pelykh](https://github.com/alexey-pelykh.png?size=30px)](https://github.com/alexey-pelykh) | Online bank statements update
[account_bank_statement_import_online_paypal](account_bank_statement_import_online_paypal/) | 12.0.1.1.0 | [![alexey-pelykh](https://github.com/alexey-pelykh.png?size=30px)](https://github.com/alexey-pelykh) | Online bank statements for PayPal.com
[account_bank_statement_import_online_ponto](account_bank_statement_import_online_ponto/) | 12.0.1.1.1 | | Online Bank Statements: MyPonto.com
[account_bank_statement_import_online_qonto](account_bank_statement_import_online_qonto/) | 12.0.1.0.0 | | Online Bank Statements: Qonto.eu
[account_bank_statement_import_online_transferwise](account_bank_statement_import_online_transferwise/) | 12.0.1.1.0 | [![alexey-pelykh](https://github.com/alexey-pelykh.png?size=30px)](https://github.com/alexey-pelykh) | Online bank statements for Wise.com (TransferWise.com)
[account_bank_statement_import_paypal](account_bank_statement_import_paypal/) | 12.0.2.2.4 | | Import PayPal CSV files as Bank Statements in Odoo
[account_bank_statement_import_save_file](account_bank_statement_import_save_file/) | 12.0.1.0.0 | | Keep imported bank statements as raw data
[account_bank_statement_import_split](account_bank_statement_import_split/) | 12.0.1.0.1 | [![alexey-pelykh](https://github.com/alexey-pelykh.png?size=30px)](https://github.com/alexey-pelykh) | Split statements by date during import
[account_bank_statement_import_transfer_move](account_bank_statement_import_transfer_move/) | 12.0.1.0.0 | | Bank Account Transfer Line
[account_bank_statement_import_txt_xlsx](account_bank_statement_import_txt_xlsx/) | 12.0.2.0.5 | [![alexey-pelykh](https://github.com/alexey-pelykh.png?size=30px)](https://github.com/alexey-pelykh) | Import TXT/CSV or XLSX files as Bank Statements in Odoo
[//]: # (end addons)
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.
<!-- prettier-ignore-end -->
http://odoo-community.org/
## Licenses
This repository is licensed under [AGPL-3.0](LICENSE).
However, each module can have a totally different license, as long as they adhere to Odoo Community Association (OCA)
policy. Consult each module's `__manifest__.py` file, which contains a `license` key
that explains its license.
----
OCA, or the [Odoo Community Association](http://odoo-community.org/), is a nonprofit
organization whose mission is to support the collaborative development of Odoo features
and promote its widespread use.

2
account_bank_statement_import_ofx/__manifest__.py

@ -10,7 +10,7 @@
'Nicolas JEUDY,'
'Le Filament,'
'Odoo Community Association (OCA)',
'website': 'https://odoo-community.org/',
'website': 'https://github.com/OCA/bank-statement-import',
'depends': [
'account_bank_statement_import',
],

2
account_bank_statement_import_online/__manifest__.py

@ -9,7 +9,7 @@
'CorporateHub, '
'Odoo Community Association (OCA)',
'maintainers': ['alexey-pelykh'],
'website': 'https://github.com/OCA/bank-statement-import/',
'website': 'https://github.com/OCA/bank-statement-import',
'license': 'AGPL-3',
'category': 'Accounting',
'summary': 'Online bank statements update',

2
account_bank_statement_import_online_paypal/__manifest__.py

@ -9,7 +9,7 @@
'CorporateHub, '
'Odoo Community Association (OCA)',
'maintainers': ['alexey-pelykh'],
'website': 'https://github.com/OCA/bank-statement-import/',
'website': 'https://github.com/OCA/bank-statement-import',
'license': 'AGPL-3',
'category': 'Accounting',
'summary': 'Online bank statements for PayPal.com',

244
account_bank_statement_import_online_paypal/tests/test_account_bank_statement_import_online_paypal.py

@ -1,4 +1,5 @@
# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
# Copyright 2022 CorporateHub (https://corporatehub.eu)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from datetime import datetime
@ -53,6 +54,13 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
super().setUp()
self.now = fields.Datetime.now()
self.now_isoformat = self.now.isoformat() + '+0000'
self.today = datetime(self.now.year, self.now.month, self.now.day)
self.today_isoformat = self.today.isoformat() + '+0000'
self.today_timestamp = str(int(self.today.timestamp()))
self.yesterday = self.today - relativedelta(days=1)
self.yesterday_isoformat = self.yesterday.isoformat() + '+0000'
self.yesterday_timestamp = str(int(self.yesterday.timestamp()))
self.currency_eur = self.env.ref('base.EUR')
self.currency_usd = self.env.ref('base.USD')
self.AccountJournal = self.env['account.journal']
@ -220,9 +228,10 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
}
],
"account_id": "1234567890",
"as_of_time": "2019-08-01T00:00:00+0000",
"last_refresh_time": "2019-08-01T00:00:00+0000"
}""")
"as_of_time": "%s",
"last_refresh_time": "%s"
}""" % (self.now_isoformat, self.now_isoformat,)
)
with mock.patch(
_provider_class + '._paypal_urlopen',
side_effect=[mocked_response_1, mocked_response_2],
@ -297,14 +306,17 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
mocked_response_1 = json.loads("""{
"transaction_details": [],
"account_number": "1234567890",
"start_date": "2019-08-01T00:00:00+0000",
"end_date": "2019-08-01T00:00:00+0000",
"last_refreshed_datetime": "2019-09-01T00:00:00+0000",
"start_date": "%s",
"end_date": "%s",
"last_refreshed_datetime": "%s",
"page": 1,
"total_items": 0,
"total_pages": 0
}""", parse_float=Decimal)
mocked_response_2 = json.loads("""{
}""" % (self.now_isoformat, self.now_isoformat, self.now_isoformat,),
parse_float=Decimal,
)
mocked_response_2 = json.loads(
"""{
"balances": [
{
"currency": "EUR",
@ -324,9 +336,12 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
}
],
"account_id": "1234567890",
"as_of_time": "2019-08-01T00:00:00+0000",
"last_refresh_time": "2019-08-01T00:00:00+0000"
}""", parse_float=Decimal)
"as_of_time": "%s",
"last_refresh_time": "%s"
}"""
% (self.now_isoformat, self.now_isoformat,),
parse_float=Decimal,
)
with mock.patch(
_provider_class + '._paypal_retrieve',
side_effect=[mocked_response_1, mocked_response_2],
@ -355,13 +370,15 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
mocked_response = json.loads("""{
"transaction_details": [],
"account_number": "1234567890",
"start_date": "2019-08-01T00:00:00+0000",
"end_date": "2019-08-01T00:00:00+0000",
"last_refreshed_datetime": "2019-09-01T00:00:00+0000",
"start_date": "%s",
"end_date": "%s",
"last_refreshed_datetime": "%s",
"page": 1,
"total_items": 0,
"total_pages": 0
}""", parse_float=Decimal)
}""" % (self.now_isoformat, self.now_isoformat, self.now_isoformat,),
parse_float=Decimal,
)
with mock.patch(
_provider_class + '._paypal_retrieve',
return_value=mocked_response,
@ -389,8 +406,8 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
"paypal_account_id": "1234567890",
"transaction_id": "1234567890",
"transaction_event_code": "T1234",
"transaction_initiation_date": "2019-08-01T00:00:00+0000",
"transaction_updated_date": "2019-08-01T00:00:00+0000",
"transaction_initiation_date": "%s",
"transaction_updated_date": "%s",
"transaction_amount": {
"currency_code": "USD",
"value": "1000.00"
@ -431,8 +448,8 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
"paypal_account_id": "1234567890",
"transaction_id": "1234567891",
"transaction_event_code": "T1234",
"transaction_initiation_date": "2019-08-02T00:00:00+0000",
"transaction_updated_date": "2019-08-02T00:00:00+0000",
"transaction_initiation_date": "%s",
"transaction_updated_date": "%s",
"transaction_amount": {
"currency_code": "USD",
"value": "1000.00"
@ -470,43 +487,53 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
"incentive_info": {}
}],
"account_number": "1234567890",
"start_date": "2019-08-01T00:00:00+0000",
"end_date": "2019-08-02T00:00:00+0000",
"last_refreshed_datetime": "2019-09-01T00:00:00+0000",
"start_date": "%s",
"end_date": "%s",
"last_refreshed_datetime": "%s",
"page": 1,
"total_items": 1,
"total_pages": 1
}""", parse_float=Decimal)
}""" % (
self.yesterday_isoformat,
self.yesterday_isoformat,
self.today_isoformat,
self.today_isoformat,
self.yesterday_isoformat,
self.today_isoformat,
self.now_isoformat,
),
parse_float=Decimal,
)
with mock.patch(
_provider_class + '._paypal_retrieve',
return_value=mocked_response,
), self.mock_token():
data = provider._obtain_statement_data(
datetime(2019, 8, 1),
datetime(2019, 8, 2),
)
data = provider._obtain_statement_data(self.yesterday, self.today,)
self.assertEqual(len(data[0]), 2)
self.assertEqual(data[0][0], {
'date': datetime(2019, 8, 1),
'amount': '1000.00',
'name': 'Invoice 1',
'note': '1234567890: Payment for Invoice(s) 1',
'partner_name': 'Acme, Inc.',
'unique_import_id': '1234567890-1564617600',
})
self.assertEqual(data[0][1], {
'date': datetime(2019, 8, 1),
'amount': '-100.00',
'name': 'Fee for Invoice 1',
'note': 'Transaction fee for 1234567890: Payment for Invoice(s) 1',
'partner_name': 'PayPal',
'unique_import_id': '1234567890-1564617600-FEE',
})
self.assertEqual(data[1], {
'balance_start': 0.0,
'balance_end_real': 900.0,
})
self.assertEqual(
data[0][0],
{
"date": self.yesterday,
"amount": "1000.00",
"name": "Invoice 1",
"note": "1234567890: Payment for Invoice(s) 1",
"partner_name": "Acme, Inc.",
"unique_import_id": "1234567890-%s" % (self.yesterday_timestamp,),
},
)
self.assertEqual(
data[0][1],
{
"date": self.yesterday,
"amount": "-100.00",
"name": "Fee for Invoice 1",
"note": "Transaction fee for 1234567890: Payment for Invoice(s) 1",
"partner_name": "PayPal",
"unique_import_id": "1234567890-%s-FEE" % (self.yesterday_timestamp,),
},
)
self.assertEqual(data[1], {"balance_start": 0.0, "balance_end_real": 900.0})
def test_transaction_parse_1(self):
lines = self.paypal_parse_transaction("""{
@ -514,8 +541,8 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
"paypal_account_id": "1234567890",
"transaction_id": "1234567890",
"transaction_event_code": "T1234",
"transaction_initiation_date": "2019-08-01T00:00:00+0000",
"transaction_updated_date": "2019-08-01T00:00:00+0000",
"transaction_initiation_date": "%s",
"transaction_updated_date": "%s",
"transaction_amount": {
"currency_code": "USD",
"value": "1000.00"
@ -551,16 +578,20 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
"store_info": {},
"auction_info": {},
"incentive_info": {}
}""")
}""" % (self.today_isoformat, self.today_isoformat,)
)
self.assertEqual(len(lines), 1)
self.assertEqual(lines[0], {
'date': datetime(2019, 8, 1),
'amount': '1000.00',
'name': 'Invoice 1',
'note': '1234567890: Payment for Invoice(s) 1',
'partner_name': 'Acme, Inc.',
'unique_import_id': '1234567890-1564617600',
})
self.assertEqual(
lines[0],
{
"date": self.today,
"amount": "1000.00",
"name": "Invoice 1",
"note": "1234567890: Payment for Invoice(s) 1",
"partner_name": "Acme, Inc.",
"unique_import_id": "1234567890-%s" % (self.today_timestamp,),
},
)
def test_transaction_parse_2(self):
lines = self.paypal_parse_transaction("""{
@ -568,8 +599,8 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
"paypal_account_id": "1234567890",
"transaction_id": "1234567890",
"transaction_event_code": "T1234",
"transaction_initiation_date": "2019-08-01T00:00:00+0000",
"transaction_updated_date": "2019-08-01T00:00:00+0000",
"transaction_initiation_date": "%s",
"transaction_updated_date": "%s",
"transaction_amount": {
"currency_code": "USD",
"value": "1000.00"
@ -605,16 +636,20 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
"store_info": {},
"auction_info": {},
"incentive_info": {}
}""")
}""" % (self.today_isoformat, self.today_isoformat,)
)
self.assertEqual(len(lines), 1)
self.assertEqual(lines[0], {
'date': datetime(2019, 8, 1),
'amount': '1000.00',
'name': 'Invoice 1',
'note': '1234567890: Payment for Invoice(s) 1',
'partner_name': 'Acme, Inc.',
'unique_import_id': '1234567890-1564617600',
})
self.assertEqual(
lines[0],
{
"date": self.today,
"amount": "1000.00",
"name": "Invoice 1",
"note": "1234567890: Payment for Invoice(s) 1",
"partner_name": "Acme, Inc.",
"unique_import_id": "1234567890-%s" % (self.today_timestamp,),
},
)
def test_transaction_parse_3(self):
lines = self.paypal_parse_transaction("""{
@ -622,8 +657,8 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
"paypal_account_id": "1234567890",
"transaction_id": "1234567890",
"transaction_event_code": "T1234",
"transaction_initiation_date": "2019-08-01T00:00:00+0000",
"transaction_updated_date": "2019-08-01T00:00:00+0000",
"transaction_initiation_date": "%s",
"transaction_updated_date": "%s",
"transaction_amount": {
"currency_code": "USD",
"value": "1000.00"
@ -659,24 +694,31 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
"store_info": {},
"auction_info": {},
"incentive_info": {}
}""")
}""" % (self.today_isoformat, self.today_isoformat,)
)
self.assertEqual(len(lines), 2)
self.assertEqual(lines[0], {
'date': datetime(2019, 8, 1),
'amount': '1000.00',
'name': 'Invoice 1',
'note': '1234567890: Payment for Invoice(s) 1',
'partner_name': 'Acme, Inc.',
'unique_import_id': '1234567890-1564617600',
})
self.assertEqual(lines[1], {
'date': datetime(2019, 8, 1),
'amount': '-100.00',
'name': 'Fee for Invoice 1',
'note': 'Transaction fee for 1234567890: Payment for Invoice(s) 1',
'partner_name': 'PayPal',
'unique_import_id': '1234567890-1564617600-FEE',
})
self.assertEqual(
lines[0],
{
"date": self.today,
"amount": "1000.00",
"name": "Invoice 1",
"note": "1234567890: Payment for Invoice(s) 1",
"partner_name": "Acme, Inc.",
"unique_import_id": "1234567890-%s" % (self.today_timestamp,),
},
)
self.assertEqual(
lines[1],
{
"date": self.today,
"amount": "-100.00",
"name": "Fee for Invoice 1",
"note": "Transaction fee for 1234567890: Payment for Invoice(s) 1",
"partner_name": "PayPal",
"unique_import_id": "1234567890-%s-FEE" % (self.today_timestamp,),
},
)
def test_transaction_parse_4(self):
lines = self.paypal_parse_transaction("""{
@ -684,8 +726,8 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
"paypal_account_id": "1234567890",
"transaction_id": "1234567890",
"transaction_event_code": "T1234",
"transaction_initiation_date": "2019-08-01T00:00:00+0000",
"transaction_updated_date": "2019-08-01T00:00:00+0000",
"transaction_initiation_date": "%s",
"transaction_updated_date": "%s",
"transaction_amount": {
"currency_code": "USD",
"value": "1000.00"
@ -717,13 +759,17 @@ class TestAccountBankAccountStatementImportOnlinePayPal(
"store_info": {},
"auction_info": {},
"incentive_info": {}
}""")
}""" % (self.today_isoformat, self.today_isoformat,)
)
self.assertEqual(len(lines), 1)
self.assertEqual(lines[0], {
'date': datetime(2019, 8, 1),
'amount': '1000.00',
'name': 'Invoice 1',
'note': '1234567890: Payment for Invoice(s) 1',
'partner_name': 'Acme, Inc.',
'unique_import_id': '1234567890-1564617600',
})
self.assertEqual(
lines[0],
{
"date": self.today,
"amount": "1000.00",
"name": "Invoice 1",
"note": "1234567890: Payment for Invoice(s) 1",
"partner_name": "Acme, Inc.",
"unique_import_id": "1234567890-%s" % (self.today_timestamp,),
},
)

2
account_bank_statement_import_online_transferwise/__manifest__.py

@ -9,7 +9,7 @@
'CorporateHub, '
'Odoo Community Association (OCA)',
'maintainers': ['alexey-pelykh'],
'website': 'https://github.com/OCA/bank-statement-import/',
'website': 'https://github.com/OCA/bank-statement-import',
'license': 'AGPL-3',
'category': 'Accounting',
'summary': 'Online bank statements for Wise.com (TransferWise.com)',

1
account_bank_statement_import_save_file/__manifest__.py

@ -8,6 +8,7 @@
'license': 'AGPL-3',
'category': 'Banking addons',
'summary': 'Keep imported bank statements as raw data',
'website': 'https://github.com/OCA/bank-statement-import',
'depends': [
'account_bank_statement_import',
],

2
account_bank_statement_import_split/__manifest__.py

@ -9,7 +9,7 @@
'CorporateHub, '
'Odoo Community Association (OCA)',
'maintainers': ['alexey-pelykh'],
'website': 'https://github.com/OCA/bank-statement-import/',
'website': 'https://github.com/OCA/bank-statement-import',
'license': 'AGPL-3',
'category': 'Accounting',
'summary': 'Split statements by date during import',

4
requirements.txt

@ -0,0 +1,4 @@
# generated from manifests external_dependencies
cryptography
ofxparse
xlrd
Loading…
Cancel
Save