Skip to content

Fork Sync Branch 19.0 - #20

Merged
btl-bot merged 8 commits into
BTLzdravtech:19.0from
ingadhoc:19.0
Oct 1, 2026
Merged

btl-bot merged 8 commits into
BTLzdravtech:19.0from
ingadhoc:19.0

Conversation

@btl-bot

@btl-bot btl-bot commented Oct 1, 2026

Copy link
Copy Markdown

No description provided.

feg-adhoc and others added 8 commits September 25, 2026 12:35
Replaces every patch 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.

Adds a "Test Import" button, on the mapping and next to "Import and View" in
the import wizard, that reads a real file the way an import would and reports
what would come in without saving anything: no statement, no transaction, and
not even the bank_statements_source the real import writes on the journal.

Explains the date format, which is the hardest field of the mapping to get
right: the preview reads it back in words and lists the codes, highlighting the
ones the mapping uses, and the field help carries the same legend. Month names
are now read in Spanish as well as English, so a file with '21-Ago-2026' and a
format of '%d-%b-%Y' no longer fails.

A failed import explains itself: it names the mapping and what is wrong with
it, keeps the raw parser error at the end as the technical detail, and offers a
button that opens the preview of that mapping.

The rest are the fixes we used to carry as patches on the base modules, brought
in as an extension: case and padding insensitive column matching, numeric cells
of an xlsx kept native, a decimal mark the mapping does not account for refused
instead of silently shifting the amount, a clearer name and help for the header
row number, and the amount columns cleared when the amount type changes. It
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, and it
stops rendering the statement PDF while importing, which is what makes large
imports time out.

Part-of: #439
Signed-off-by: rov-adhoc <rov@adhoc.com.ar>
…nd the testing

Five findings of the review. None of them breaks the module as it stands,
and two are tests over behaviour that nothing was holding.

- An error raised by another override of `_parse_file` is no longer
  relabelled as a mapping problem. Only what the sheet module wrapped
  carries a cause, and only that is explained; anything else reaches the
  user with its own message, instead of sending them to fix the mapping.
- The amount error is raised as a SheetMappingError, so the import knows
  it by its type. `_bg` re-raises a failure as a plain UserError carrying
  the text, and on a database in Spanish that text arrives translated and
  no English signal matches it.
- The sample of the preview writes the decimals of the currency instead
  of always two. A Chilean statement has none, and the sample is meant to
  be imported as is.
- A test reads a file both ways, as a test import and as a real one, and
  compares what each finds. `_test_import_file` mirrors
  `import_single_statement` by hand, and until now nothing failed when
  the two drifted.
- A test asserts this module loads above `_bg`, which is what the wrapper
  of the button rests on. It is the depth of the dependency graph that
  puts it there, not luck; the test skips where `_bg` is not installed.

Three more from the functional testing.

- The preview opens for an accountant. A server action with no groups
  demands write access on its model, and only an accounting manager has
  it on the mappings, so the button of the error message answered whoever
  imports that they are not allowed to look at a preview.
- A header row read as a transaction is named as such. With the header
  row number at 0 the first thing that breaks is the date, so the parser
  complained about the format of a date that was never one and sent the
  user to fix a field that is right. The date that cannot be read is now
  compared with the columns of the mapping, and the message the preview
  already had is raised instead.
- The test of the parity imports with the context of the background job.
  Where `_bg` is installed the button enqueues the file, so nothing was
  created and the test read that as the report and the import disagreeing.

Part-of: #439
Signed-off-by: rov-adhoc <rov@adhoc.com.ar>
…ts a worker can finish

A part of 3000 rows does not finish inside the CPU time a worker is
given: the job stays "running" until it is killed, and the user is left
splitting the file by hand. 1000 rows is the size that is known to go
through, so the module splits the file into parts of that size instead.

The Spanish translation is filled in as well. Every message of this
module was reaching the user in English, the notice of the import that
was sent to the background among them.

Change note: los archivos grandes de extractos bancarios se parten en
tramos de 1000 líneas en lugar de 3000, que es el tamaño que el proceso
en segundo plano alcanza a terminar. Un archivo se reparte entre más
extractos que antes, uno por tramo. Los mensajes del módulo pasan a
verse en español.

Part-of: #439
Signed-off-by: rov-adhoc <rov@adhoc.com.ar>
… of the base module

`Skip Empty Lines`, `Offset Column` and the help of the decimals separator
reach the user in English: their terms are empty in the Spanish catalogue
of the base module, which is not ours to fill in. A term is only
translated by the module that declares it, so the three fields are
redefined here, with the wording they already have, and translated in the
catalogue of this module -- the same way the header row number and the
help of the amount type were.

The message of the offsets constraint stays in English. It is raised from
the base module, and a python term is looked up in the catalogue of the
module whose file calls it, so no translation of ours reaches it.

Change note: en el mapeo de importación de extractos pasan a verse en
español «Saltear líneas vacías», «Columna desplazada» y sus ayudas, junto
con la ayuda del separador de decimales.

closes #439

Signed-off-by: rov-adhoc <rov@adhoc.com.ar>
…, account_statement_import_sheet_file_ux 19.0.1.1.0

Merged: #439
…systems generate

Since the 19.0 refactor, the sheet module picks the parser from the
mimetype of the file. An xls is an OLE compound file, and Odoo tells a
workbook apart from the other old Office files only by the text
"Microsoft Excel" inside it. The xls that bank systems generate (Banco
Credicoop, for one) often do not carry it, so the guess stays on the
generic container and the import fails with "Unsupported sheet type:
None". Up to 18.0 the file was simply tried with xlrd, so the same file
used to import.

When the guess finds no parser and the file is an OLE compound file that
xlrd can open, it is now read as an xls.

Change note: se pueden importar los extractos en xls que generan los
sistemas de algunos bancos (por ejemplo, Banco Credicoop), que antes
fallaban con «Unsupported sheet type: None».

closes #454

Signed-off-by: rov-adhoc <rov@adhoc.com.ar>

@sireko sireko 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.

Auto approved

@btl-bot
btl-bot merged commit 76cb0f0 into BTLzdravtech:19.0 Oct 1, 2026
1 check passed
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.

6 participants