From 6cce830d7e36943c3e0eccb812900e19b9b690ab Mon Sep 17 00:00:00 2001 From: Ken Woychesko Date: Wed, 3 May 2023 17:06:06 -0400 Subject: [PATCH] [FIX] account_statement_import_online_paypal: force observance of "Allow Empty Statements" provider setting Empty statements should only be created if "Allow Empty Statements" is checked. This commit adds a check for the state of the allow_empty_statements field. --- .../README.rst | 15 ++-- .../__manifest__.py | 2 +- .../online_bank_statement_provider_paypal.py | 7 +- .../static/description/index.html | 48 ++++++----- ..._account_statement_import_online_paypal.py | 83 ++++++++++++++++++- 5 files changed, 121 insertions(+), 34 deletions(-) diff --git a/account_statement_import_online_paypal/README.rst b/account_statement_import_online_paypal/README.rst index 2ab7b118..3b3112be 100644 --- a/account_statement_import_online_paypal/README.rst +++ b/account_statement_import_online_paypal/README.rst @@ -2,10 +2,13 @@ Online Bank Statements: PayPal.com ================================== -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:26af4e5288afb6f7af8bd84132925bd6dea1bf3bbb77c739000c747423e4dc9e + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -19,11 +22,11 @@ Online Bank Statements: PayPal.com .. |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_paypal :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 +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/bank-statement-import&target_branch=15.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| This module provides online bank statements from `PayPal.com `__. @@ -105,7 +108,7 @@ 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 +If you spotted it first, help us to smash it by providing a detailed and welcomed `feedback `_. Do not contact contributors directly about support or help with technical issues. diff --git a/account_statement_import_online_paypal/__manifest__.py b/account_statement_import_online_paypal/__manifest__.py index af7870d3..d4b785bd 100644 --- a/account_statement_import_online_paypal/__manifest__.py +++ b/account_statement_import_online_paypal/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Online Bank Statements: PayPal.com", - "version": "15.0.1.1.0", + "version": "15.0.1.1.1", "author": "CorporateHub, Odoo Community Association (OCA)", "maintainers": ["alexey-pelykh"], "website": "https://github.com/OCA/bank-statement-import", diff --git a/account_statement_import_online_paypal/models/online_bank_statement_provider_paypal.py b/account_statement_import_online_paypal/models/online_bank_statement_provider_paypal.py index 8665ac5c..b48b3991 100644 --- a/account_statement_import_online_paypal/models/online_bank_statement_provider_paypal.py +++ b/account_statement_import_online_paypal/models/online_bank_statement_provider_paypal.py @@ -206,8 +206,11 @@ class OnlineBankStatementProviderPayPal(models.Model): token, currency, date_since, date_until ) if not transactions: - balance = self._paypal_get_balance(token, currency, date_since) - return [], {"balance_start": balance, "balance_end_real": balance} + if self.allow_empty_statements: + balance = self._paypal_get_balance(token, currency, date_since) + return [], {"balance_start": balance, "balance_end_real": balance} + else: + return None # Normalize transactions, sort by date, and get lines transactions = list( diff --git a/account_statement_import_online_paypal/static/description/index.html b/account_statement_import_online_paypal/static/description/index.html index af8636c0..8b3c341a 100644 --- a/account_statement_import_online_paypal/static/description/index.html +++ b/account_statement_import_online_paypal/static/description/index.html @@ -1,20 +1,20 @@ - + - + Online Bank Statements: PayPal.com