From 5dde51681afe6afec36235c900bd5b1dba09e57a Mon Sep 17 00:00:00 2001 From: Vincent Barrier Date: Wed, 3 Jul 2019 20:57:01 +0200 Subject: [PATCH] [FIX] account_bank_statement_import_paypal: Filter Exception => UnicodeDecodeError + refactoring + exception using multiple files type --- .../wizards/account_bank_statement_import_paypal.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/account_statement_import_paypal/wizards/account_bank_statement_import_paypal.py b/account_statement_import_paypal/wizards/account_bank_statement_import_paypal.py index ba79b534..a6db902f 100644 --- a/account_statement_import_paypal/wizards/account_bank_statement_import_paypal.py +++ b/account_statement_import_paypal/wizards/account_bank_statement_import_paypal.py @@ -66,9 +66,13 @@ class AccountBankStatementImport(models.TransientModel): @api.model def _check_paypal(self, data_file): - data_file = self._get_paypal_str_data(data_file) if not self.paypal_map_id: return False + try: + data_file = self._get_paypal_str_data(data_file) + except UnicodeDecodeError as e: + _logger.debug(e) + return False headers = self.mapped('paypal_map_id.map_line_ids.name') file_headers = data_file.split('\n', 1)[0] if any(item not in file_headers for item in headers):