mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[FIX] account_statement_import_sheet_file: Prevent negative index in parser header
When importing an Excel file with a header and the field header_lines_skip_count is set to its default value (0), the header is retrieved using the -1 index (the last row).
complementary to commit 13285abe74
This commit is contained in:
@@ -179,7 +179,10 @@ class AccountStatementImportSheetParser(models.TransientModel):
|
||||
csv_or_xlsx = reader(StringIO(decoded_file), **csv_options)
|
||||
header = False
|
||||
if not mapping.no_header:
|
||||
header_line = mapping.header_lines_skip_count - 1
|
||||
header_line = mapping.header_lines_skip_count
|
||||
# prevent negative indexes
|
||||
if header_line > 0:
|
||||
header_line -= 1
|
||||
if isinstance(csv_or_xlsx, tuple):
|
||||
header = [
|
||||
str(value).strip()
|
||||
|
||||
Reference in New Issue
Block a user