[FIX] account_bank_statement_import_paypal: Parser bug for required fields

The fields required for the paypal parser are set as None and don't throw the
ValueError. With this changes we achieve to filter the data and throw the exception
when the fields are required.

TT29944
This commit is contained in:
Carlos Roca
2021-07-14 13:49:41 +02:00
parent 9cfee1ad57
commit 509e0deca5

View File

@@ -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: