Skip to content
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
125 changes: 125 additions & 0 deletions account_statement_import_sheet_file_ux/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
.. |company| replace:: ADHOC SA

.. |company_logo| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-logo.png
:alt: ADHOC SA
:target: https://www.adhoc.com.ar

.. |icon| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-icon.png

.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

===============================
Bank Statement Sheet Import UX
===============================

Most of the support around the statement sheet import comes from mappings that
do not match 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 (``'Debits' is not in list``) says nothing about which part of the
mapping is wrong.

* Adds a **"Preview Mapping"** button on the statement sheet mapping. It shows a
sample sheet, with column letters and row numbers, built from the mapping as
it is configured right now: where the header row must be, which columns must
exist, and how dates and amounts must be written. Three sample transactions
are filled in so the layout is unambiguous.
* The sample can be downloaded as an **xlsx** file. Every cell is written as
text, the way the parser reads them, so the sample file can be imported with
that very mapping to check it end to end before fighting with the real
statement.
* The preview reads the mapping back to the user in plain words (date format,
separators, ignored rows and columns) and **warns about the configurations
that are going to fail**: a header row number of 0 (the header row is then
read as a transaction too and the spreadsheet import fails), or column names
on a mapping declared as having no header line.
* Rewrites the error of a **failed import**. Instead of the bare
``'Date' is not in list``, it names the mapping and the column that is
missing (or the date format that does not match), tells the user to check the
Columns section and the preview, and offers a button that opens the mapping
right there.
* Matches the configured column names **ignoring case and padding**, so a bank
that exports ``DATE`` one month and ``Date`` the next one does not break the
import.
* Renames the ``Header lines skip count`` field to **Header row number** and
explains what the number means, which is where most of the wrong mappings
come from.
* Clears the amount columns when the **Amount type** changes, so a mapping
cannot keep columns that no longer apply to it.

Technical notes
===============

* The preview is built by ``account.statement.import.sheet.mapping._preview_layout()``,
which follows what the parser actually does: the header sits on
``max(header_lines_skip_count, 1)`` and the transactions start right after
``header_lines_skip_count``. Ignored rows carry a label so that they exist in
the exported file and the row numbers do not shift.
* With ``no_header`` the mapping holds column indexes, so each field lands on
the position it declares. With a header the file order is irrelevant to the
parser, so the preview lays the columns out in the order of the form and says
so.
* ``_get_column_indexes`` rewrites 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.
* ``_parse_decimal`` casts the raw ``int`` / ``float`` values the xls parser
hands over, which the standard method only handles for ``str``, ``float`` and
``Decimal``.
* ``account.statement.import._parse_file`` catches the ``UserError`` the sheet
module raises and re-raises a ``RedirectWarning`` carrying the original text
plus the hint. The redirect action is built inline instead of pointing at a
preview record, because the failed transaction is rolled back and any record
created in that path would no longer exist when the user clicks the button.

Installation
============

Only install the module. It is auto installed as soon as
``account_statement_import_sheet_file`` is installed, and it pulls
``account_statement_import_sheet_file_xls`` and
``account_statement_import_sheet_file_xlsx`` with it, so a base that can import
csv statements can also import xls and xlsx ones.

Configuration
=============

This module does not need any configuration.

Usage
=====

Go to "Accounting > Configuration > Statement Sheet Mappings", open a mapping and
click "Preview Mapping".

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: http://runbot.adhoc.com.ar/

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/ingadhoc/miscellaneous/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.

Credits
=======

Images
------

* |company| |icon|

Contributors
------------

Maintainer
----------

|company_logo|

This module is maintained by the |company|.

To contribute to this module, please visit https://www.adhoc.com.ar.
2 changes: 2 additions & 0 deletions account_statement_import_sheet_file_ux/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizard
43 changes: 43 additions & 0 deletions account_statement_import_sheet_file_ux/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
##############################################################################
#
# Copyright (C) 2026 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name": "Bank Statement Sheet Import UX",
"version": "19.0.1.0.0",
"category": "Accounting",
"summary": "Preview of the expected file for a statement sheet mapping, "
"plus usability fixes on the mapping configuration and the column parser",
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"images": [],
"depends": [
"account_statement_import_sheet_file",
"account_statement_import_sheet_file_xls",
"account_statement_import_sheet_file_xlsx",
],
"data": [
"security/ir.model.access.csv",
"views/account_statement_import_sheet_mapping_preview_views.xml",
"views/account_statement_import_sheet_mapping_views.xml",
],
"installable": True,
"auto_install": ["account_statement_import_sheet_file"],
"application": False,
}
Loading