Skip to content

Commit

Permalink
[FIX] account_statement_import_sheet_file: Prevent negative index in …
Browse files Browse the repository at this point in the history
…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 13285ab
  • Loading branch information
carlos-lopez-tecnativa committed Jan 13, 2025
1 parent 2298d49 commit bb47930
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ def _parse_lines(self, mapping, data_file, currency_code):
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()
Expand Down

0 comments on commit bb47930

Please sign in to comment.