[FIX] account_bank_statement_import_paypal: parse only if mapping if specified

This commit is contained in:
Miquel Raïch
2023-04-13 10:22:28 +02:00
parent 1d1534b6f5
commit c9fb20db23

View File

@@ -21,13 +21,14 @@ class AccountBankStatementImport(models.TransientModel):
def _parse_file(self, data_file): def _parse_file(self, data_file):
self.ensure_one() self.ensure_one()
try: if self.paypal_mapping_id:
Parser = self.env["account.bank.statement.import.paypal.parser"] try:
return Parser.parse( Parser = self.env["account.bank.statement.import.paypal.parser"]
self.paypal_mapping_id, data_file, self.attachment_ids[:1].name 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"): except Exception:
raise if self.env.context.get("account_bank_statement_import_paypal_test"):
_logger.warning("PayPal parser error", exc_info=True) raise
_logger.warning("PayPal parser error", exc_info=True)
return super()._parse_file(data_file) return super()._parse_file(data_file)