From c9fb20db236b7c1944d9d3f68b1db66cb11b7537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Ra=C3=AFch?= Date: Thu, 13 Apr 2023 10:22:28 +0200 Subject: [PATCH] [FIX] account_bank_statement_import_paypal: parse only if mapping if specified --- .../models/account_bank_statement_import.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/account_bank_statement_import_paypal/models/account_bank_statement_import.py b/account_bank_statement_import_paypal/models/account_bank_statement_import.py index 37c74dea..8b0fed2b 100644 --- a/account_bank_statement_import_paypal/models/account_bank_statement_import.py +++ b/account_bank_statement_import_paypal/models/account_bank_statement_import.py @@ -21,13 +21,14 @@ class AccountBankStatementImport(models.TransientModel): def _parse_file(self, data_file): self.ensure_one() - try: - Parser = self.env["account.bank.statement.import.paypal.parser"] - return Parser.parse( - self.paypal_mapping_id, data_file, self.attachment_ids[:1].name - ) - except Exception: - if self.env.context.get("account_bank_statement_import_paypal_test"): - raise - _logger.warning("PayPal parser error", exc_info=True) + if self.paypal_mapping_id: + try: + Parser = self.env["account.bank.statement.import.paypal.parser"] + return Parser.parse( + self.paypal_mapping_id, data_file, self.attachment_ids[:1].name + ) + except Exception: + if self.env.context.get("account_bank_statement_import_paypal_test"): + raise + _logger.warning("PayPal parser error", exc_info=True) return super()._parse_file(data_file)