[ADD] account_statement_import_sheet_file_ux: preview the file a mapping expects - #439
Open
feg-adhoc wants to merge 1 commit into
Open
[ADD] account_statement_import_sheet_file_ux: preview the file a mapping expects#439feg-adhoc wants to merge 1 commit into
feg-adhoc wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Este PR incorpora el nuevo módulo account_statement_import_sheet_file_ux para mejorar la experiencia de configuración e importación de extractos bancarios en planillas (xls/xlsx), agregando previsualización del archivo esperado, generación de un sample importable y errores de importación más accionables para guiar al usuario hacia la corrección del mapping.
Changes:
- Agrega un wizard de “Mapping preview” que renderiza un sample visual (HTML) y permite descargar un xlsx consistente con el mapping.
- Mejora la importación: ante fallas de parseo, eleva un
RedirectWarningcon contexto (mapping/columna/formato) y acceso directo al mapping. - Ajusta el comportamiento del parser y del mapping: matching de columnas case/trim-insensitive, parseo de decimales desde números crudos, rename de “header lines skip count” a “Header row number”, y limpieza de columnas al cambiar el Amount type.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| account_statement_import_sheet_file_ux/init.py | Inicializa el módulo cargando models y wizard. |
| account_statement_import_sheet_file_ux/manifest.py | Declara el módulo, dependencias y data (vistas + ACL). |
| account_statement_import_sheet_file_ux/README.rst | Documenta funcionalidad, uso y notas técnicas del módulo UX. |
| account_statement_import_sheet_file_ux/i18n/account_statement_import_sheet_file_ux.pot | Template de traducciones para los nuevos textos (Python y QWeb). |
| account_statement_import_sheet_file_ux/security/ir.model.access.csv | ACL para el wizard de preview. |
| account_statement_import_sheet_file_ux/models/init.py | Exporta los overrides del mapping y del parser. |
| account_statement_import_sheet_file_ux/models/account_statement_import_sheet_mapping.py | Implementa preview layout/notes/warnings, botón de preview y mejoras UX del mapping. |
| account_statement_import_sheet_file_ux/models/account_statement_import_sheet_parser.py | Hace el matching de headers case/trim-insensitive y acepta números crudos en _parse_decimal. |
| account_statement_import_sheet_file_ux/wizard/init.py | Registra los wizards nuevos/extendidos. |
| account_statement_import_sheet_file_ux/wizard/account_statement_import.py | Override de _parse_file para re-lanzar errores como RedirectWarning con hint accionable. |
| account_statement_import_sheet_file_ux/wizard/account_statement_import_sheet_mapping_preview.py | Wizard que renderiza el HTML y genera/descarga el xlsx sample. |
| account_statement_import_sheet_file_ux/views/account_statement_import_sheet_mapping_views.xml | Inserta el botón “Preview Mapping” en la vista del mapping. |
| account_statement_import_sheet_file_ux/views/account_statement_import_sheet_mapping_preview_views.xml | QWeb template del preview + vista form del wizard con botón de descarga. |
| account_statement_import_sheet_file_ux/tests/init.py | Habilita la carga del suite de tests del módulo. |
| account_statement_import_sheet_file_ux/tests/test_mapping_preview.py | Cobertura de preview/layout, sample importable, parser fixes y RedirectWarning en imports fallidos. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
feg-adhoc
force-pushed
the
19.0-t-71587-feg
branch
from
August 26, 2026 14:19
b319b0d to
b4e3aef
Compare
feg-adhoc
force-pushed
the
19.0-t-71587-feg
branch
from
August 26, 2026 14:40
b4e3aef to
f4bca47
Compare
feg-adhoc
force-pushed
the
19.0-t-71587-feg
branch
from
August 26, 2026 15:52
f4bca47 to
0cb098e
Compare
…ing expects
Replaces the three patches we carry on top of OCA for the bank statement
import, so that the base modules stay untouched.
Most of the support around the statement sheet import comes from mappings
that do not describe the file the bank exports, and the error the user gets
back ('Date' is not in list) says nothing about which part of the mapping is
wrong.
Adds a "Preview Mapping" button on the sheet mapping that renders a sample
sheet, with column letters and row numbers, built from the mapping as it is
configured: where the header row must be, which columns must exist, and how
dates and amounts must be written, with three sample transactions filled in.
The sample can be downloaded as xlsx; every cell is written as text, the way
the parser reads them, so the file can be imported with that very mapping to
check it end to end.
The preview also reads the mapping back in plain words and warns about the
configurations that are going to fail, and a failed import now names the
mapping and the missing column (or the date format that does not match) and
offers a button that opens the mapping.
Carries the remaining fixes as an extension instead of patching the base
modules: case and padding insensitive column matching, the decimal cast the
xls parser needs, a clearer name and help for the header row number, and
clearing the amount columns when the amount type changes. Depends on the xls
and xlsx modules and auto installs with the sheet one, so a database that can
import csv statements can also import spreadsheets.
It also stops rendering the statement PDF while importing. With Enterprise
installed that render runs synchronously on create and is what makes large
imports time out, and the attachment is of no use to somebody importing the
file they already have. Odoo skips it the same way when it imports statements
itself.
Ships the Spanish of the terms this module took over from the base one (the
header row number and the amount type help) plus the preview button. The rest
of the preview and the error messages are still to be translated.
feg-adhoc
force-pushed
the
19.0-t-71587-feg
branch
from
August 26, 2026 16:45
0cb098e to
5d2ef9b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Replaces the three patches we carry on top of OCA for the bank statement import, so that the base modules stay untouched. All of it lands in one module:
account_statement_import_sheet_file19.0-h-118949-rov-2—auto_installon the xls/xlsx manifestsdepends+auto_installof this module_create_bank_statementsoverrideThe only thing not carried over is #969's removal of the duplicated
amount_columnfield definition: it is dead code (Python keeps the last definition), it cannot be undone from an external module, and it changes no behaviour.The preview
Most of the support around the statement sheet import comes from mappings that do not describe the file the bank exports: a renamed header, a header row on the wrong line, the thousands separator the other way around. The error the user gets back (
'Date' is not in list) says nothing about which part of the mapping is wrong.Preview Mappingbutton on the sheet mapping. Renders a sample sheet — column letters, row numbers, header in bold, ignored rows greyed out — built from the mapping as it is configured right now, with three sample transactions filled in so the layout is unambiguous.0(the spreadsheet parser then reads the header row as a transaction too and the import fails), or column names on a mapping declared as having no header line.RedirectWarningthat keeps the original error, names the mapping and the column that is missing (or the date format that does not match), and offers a button that opens the mapping.The fixes it carries
DATEone month andDatethe next does not break the import._parse_decimalaccepts the rawint/floatvalues the xls parser hands over.Header lines skip countis renamed toHeader row numberwith a help that explains what the number means, and the amount columns are cleared when the Amount type changes.auto_installtriggered by the sheet one, so a database that can import csv statements can also import spreadsheets.account_accountantrenders it synchronously in thecreateofaccount.bank.statement, and on a statement of a few hundred lines that render is what makes the import time out — while the attachment is of no use to somebody importing the file they already have. Odoo skips it the same way when it imports statements itself (l10n_be_codabox,l10n_be_codaclean).Notes on the approach
max(header_lines_skip_count, 1)and the transactions start right afterheader_lines_skip_count._get_column_indexesrewrites the header cells that match a configured name to the configured spelling and delegates to the standard lookup, instead of duplicating it. An unknown column still raises.skip_pdf_attachment_generationis injected onselfrather than on the values, because the base method builds the statement recordset fromself.envbefore extending its context with the per-statementcreation_context, so the key survives without duplicating the method.Test plan
18 tests, all green:
0,1,2and5, and0produces the warning.no_headerwith indexes,no_headermisconfigured with names, thenonedecimal separator and the inverse sign all render the expected cells.account_statement_import_file(the build currently carries #979, which would make the assertion pass on its own): green with the override, red without it.account_statement_import_sheet_fileon an empty database leaves the base, xls, xlsx and this module installed.Manual check pending in runbot for the visual side (button placement and modal rendering).
Task: https://www.adhoc.inc/odoo/project.task/71587