Skip to content

[FIX] account_statement_import_sheet_file_bg: adapt to sheet parser refactor - #427

Open
feg-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-h-123605-feg
Open

[FIX] account_statement_import_sheet_file_bg: adapt to sheet parser refactor#427
feg-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-h-123605-feg

Conversation

@feg-adhoc

Copy link
Copy Markdown
Contributor

Context

The OCA account_statement_import_sheet_file module was refactored: XLSX support was moved to a new module account_statement_import_sheet_file_xlsx, and the monolithic parser (parse_header / _parse_lines) was replaced by a mimetype-based dispatch (_get_sheet_type_parse_lines_<type>).

This module (_bg) was written against the old API and always emits XLSX chunks (even for CSV inputs), so after the refactor the generated chunks had no parser and the import failed with "format not supported" — including CSV imports, which are converted to XLSX before being enqueued.

Changes

  • Depend on account_statement_import_sheet_file_xlsx (the chunks are always XLSX; without it there is no _parse_lines_xlsx).
  • Rewrite split_base64_excel to read and split the file (XLSX via openpyxl, CSV fallback) without the removed parser API, using _get_column_indexes only for date-column detection.
  • Drop the xlrd path.
  • Remove the now-dead sheet parser override (it overrode parse_header, which no longer exists in the base).

Test

  • pre-commit green; module imports/splits reviewed. Pending runbot + functional check on a real base.

Copilot AI review requested due to automatic review settings July 22, 2026 19:10
@roboadhoc

Copy link
Copy Markdown
Contributor

Pull request status dashboard

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Este PR adapta account_statement_import_sheet_file_bg al refactor del parser de sheets en OCA, donde la lógica de parseo pasa a estar despachada por mimetype y el soporte XLSX se mueve a account_statement_import_sheet_file_xlsx. El objetivo es que el flujo en background vuelva a funcionar (incluyendo CSV que se convierten/enfilan como XLSX).

Changes:

  • Se agrega la dependencia a account_statement_import_sheet_file_xlsx para asegurar que existan handlers XLSX en el parseo.
  • Se reescribe split_base64_excel para leer XLSX/CSV sin depender de la API de parser anterior, y generar siempre partes en XLSX.
  • Se elimina el override muerto del parser (parse_header) y su import.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
account_statement_import_sheet_file_bg/models/account_statement_import.py Reimplementa lectura/splitting XLSX/CSV y el filtrado de filas por fecha para jobs en background.
account_statement_import_sheet_file_bg/models/init.py Elimina el import del parser override removido.
account_statement_import_sheet_file_bg/models/account_statement_import_sheet_parser.py Se borra el override de parse_header que ya no aplica tras el refactor upstream.
account_statement_import_sheet_file_bg/manifest.py Agrega dependencia a account_statement_import_sheet_file_xlsx para asegurar parseo XLSX.

Comment on lines +255 to +259
header = []
for value in all_rows[header_line]:
raw_value = value.value if hasattr(value, "value") else value
header.append(str(raw_value).strip() if raw_value is not None else "")
return header
Comment on lines 191 to 192
if date_column_index is not None:
data_rows = [r for r in data_rows if len(r) > date_column_index and r[date_column_index]]
Comment on lines +214 to +216
Supports XLSX (openpyxl) and CSV. Other formats are left to the
standard synchronous import.
"""
@feg-adhoc
feg-adhoc force-pushed the 19.0-h-123605-feg branch from 2528313 to eec9d5b Compare July 22, 2026 19:29
…efactor

The OCA refactor split XLSX support out of account_statement_import_sheet_file
into account_statement_import_sheet_file_xlsx and replaced the monolithic
parser (parse_header/_parse_lines) with a mimetype-based dispatch.

This module always emits XLSX chunks, so:
- depend on account_statement_import_sheet_file_xlsx (otherwise the chunks
  have no parser and the import fails with 'format not supported', also for
  CSV inputs that are converted to XLSX);
- rewrite split_base64_excel to read/split the file without the removed
  parser API (parse_header/_parse_rows) and drop the xlrd path;
- remove the now-dead sheet parser override.
@feg-adhoc
feg-adhoc force-pushed the 19.0-h-123605-feg branch from eec9d5b to 03cf31f Compare July 22, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants