mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[FIX] account_statement_import_paypal: parse only if mapping if specified
This commit is contained in:
@@ -21,13 +21,14 @@ class AccountStatementImport(models.TransientModel):
|
||||
|
||||
def _parse_file(self, data_file):
|
||||
self.ensure_one()
|
||||
try:
|
||||
Parser = self.env["account.statement.import.paypal.parser"]
|
||||
return Parser.parse(
|
||||
self.paypal_mapping_id, data_file, self.statement_filename
|
||||
)
|
||||
except Exception:
|
||||
if self.env.context.get("account_statement_import_paypal_test"):
|
||||
raise
|
||||
_logger.warning("PayPal parser error", exc_info=True)
|
||||
if self.paypal_mapping_id:
|
||||
try:
|
||||
Parser = self.env["account.statement.import.paypal.parser"]
|
||||
return Parser.parse(
|
||||
self.paypal_mapping_id, data_file, self.statement_filename
|
||||
)
|
||||
except Exception:
|
||||
if self.env.context.get("account_statement_import_paypal_test"):
|
||||
raise
|
||||
_logger.warning("PayPal parser error", exc_info=True)
|
||||
return super()._parse_file(data_file)
|
||||
|
||||
Reference in New Issue
Block a user