diff --git a/account_statement_import_txt_xlsx/models/account_statement_import_sheet_mapping.py b/account_statement_import_txt_xlsx/models/account_statement_import_sheet_mapping.py index a0a9e26fb..adae071c2 100644 --- a/account_statement_import_txt_xlsx/models/account_statement_import_sheet_mapping.py +++ b/account_statement_import_txt_xlsx/models/account_statement_import_sheet_mapping.py @@ -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, diff --git a/account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py b/account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py index 1d56b6ab8..29d87dcbd 100644 --- a/account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py +++ b/account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py @@ -168,6 +168,11 @@ def _parse_lines(self, mapping, data_file, currency_code): 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) + if not mapping.no_header: if isinstance(csv_or_xlsx, tuple): header = [ diff --git a/account_statement_import_txt_xlsx/views/account_statement_import_sheet_mapping.xml b/account_statement_import_txt_xlsx/views/account_statement_import_sheet_mapping.xml index 0ab58c800..d4144ee02 100644 --- a/account_statement_import_txt_xlsx/views/account_statement_import_sheet_mapping.xml +++ b/account_statement_import_txt_xlsx/views/account_statement_import_sheet_mapping.xml @@ -59,6 +59,10 @@ name="offset_row" attrs="{'invisible': [('no_header', '=', True)]}" /> +