Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0] [ADD] account_statement_import_txt_xlsx: offset header #719

Open
wants to merge 1 commit into
base: 14.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ class AccountStatementImportSheetMapping(models.Model):
help="When this occurs please indicate the column number in the Columns section "
"instead of the column name, considering that the first column is 0",
)
offset_header = fields.Integer(
"Offset Header",
default=0,
help="Number of row to ignore until the header",
)
skip_empty_lines = fields.Boolean(
"Skip Empty Lines",
default=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@
decoded_file = data_file.decode(detected_encoding)
csv_or_xlsx = reader(StringIO(decoded_file), **csv_options)
header = False

if mapping.offset_header:
for _row in range(mapping.offset_header):
next(csv_or_xlsx)

Check warning on line 174 in account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py

View check run for this annotation

Codecov / codecov/patch

account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py#L174

Added line #L174 was not covered by tests

if not mapping.no_header:
if isinstance(csv_or_xlsx, tuple):
header = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
name="offset_row"
attrs="{'invisible': [('no_header', '=', True)]}"
/>
<field
name="offset_header"
attrs="{'invisible': [('no_header', '=', True)]}"
/>
</group>
<group
attrs="{'invisible': [('debit_credit_column', '=', False)]}"
Expand Down
Loading