diff --git a/account_bank_statement_import_paypal/models/account_bank_statement_import_paypal_parser.py b/account_bank_statement_import_paypal/models/account_bank_statement_import_paypal_parser.py index 815d1d5b..2a6f323d 100644 --- a/account_bank_statement_import_paypal/models/account_bank_statement_import_paypal_parser.py +++ b/account_bank_statement_import_paypal/models/account_bank_statement_import_paypal_parser.py @@ -72,7 +72,7 @@ class AccountBankStatementImportPayPalParser(models.TransientModel): ) def _data_dict_constructor(self, mapping, header): - list_of_content = [ + required_list = [ "date_column", "time_column", "tz_column", @@ -82,6 +82,8 @@ class AccountBankStatementImportPayPalParser(models.TransientModel): "fee_column", "balance_column", "transaction_id_column", + ] + optional_list = [ "description_column", "type_column", "from_email_address_column", @@ -93,7 +95,9 @@ class AccountBankStatementImportPayPalParser(models.TransientModel): "bank_account_column", ] data_dict = {} - for key in list_of_content: + for key in required_list: + data_dict[key] = header.index(getattr(mapping, key)) + for key in optional_list: try: data_dict[key] = header.index(getattr(mapping, key)) except ValueError: