bank-statement-import icon indicating copy to clipboard operation
bank-statement-import copied to clipboard

[16.0] account_statement_import_sheet_file: keep order of rows in imported file

Open cuongnmtm opened this issue 1 year ago • 2 comments

When importing bank statements using a sheet file that contains a column with timestamps in date format, the sequence of generated journal items may not match the sequence of lines in the imported file. This happens because the rows are currently being sorted by the timestamp column.

The code that sorts rows by timestamp: https://github.com/OCA/bank-statement-import/blob/9dca998e559af55de972afe82aab627008e96b75/account_statement_import_sheet_file/models/account_statement_import_sheet_parser.py#L68

Example:

STT No. TNX Date/ CT/ Doc No Effective date Debit Credit
1 02/01/2024 / 5254 - 96829 02/01/2024 6.000  
2 02/01/2024 / 5136 - 09957 02/01/2024 2.000  
3 02/01/2024 / 5136 - 10124 02/01/2024 2.000  
4 02/01/2024 / 5136 - 10694 02/01/2024 7.000  
5 02/01/2024 / 5136 - 11486 02/01/2024 15.000  
6 03/01/2024 / 5009 - 07716 03/01/2024   15.000

generated these journal items

image

Describe the solution you'd like

A way to avoid sorting rows upon import to preserve their original order. Alternatively, allow for sorting by multiple columns.

cuongnmtm avatar Feb 07 '24 09:02 cuongnmtm

I can submit a pull request to improve this, but I'm not sure which direction to take.

Maybe an option on the mapping to skip the sort.

cuongnmtm avatar Feb 07 '24 09:02 cuongnmtm