Financial | entries | account moves: sort by number

If I remember correctly, when using “account moves”, I could sort entries by number. Most useful was a descending order, so I found most recent entries at the top of the list and could copy the number to invoice sheets and bank account statement.

Since 6.4 (maybe 6.2, I skipped that version), my entries are no longer sorted as actual numbers (1, 2, … 10, 11, …, 20, 21…) , but by first digit, so actually I find an order as 108, 1080, 1081, 1082, …, 109, 1090, 1091 etc. I don’t think, this is very useful behaviour, as my most recent entries tend to be in the middle of the list.

Is it a setting I messed up - or do I have another may to clean that up?

Thanks a lot in advance, Wolf

In 6.4 I also have the same problem with for example the sales number, which are sorted alphabetically.

Of course, I rectified this by padding the sequence for new sales with zero, but then I had the old sales left, in which case I went and padded these as well with zero in sql - a bit dangerous operation - always back up before using sql in production database.

Well, that’s not really a solution for a dummy user as I am. Do we agree that this has certain similarities with a small, 6-legged animal…?

I wanted to express that I have the same problem that you have.

I am interested in how other people have solved this problem, if there is a setting I (we) are unaware of, or if indeed a patch is required.

You are right that the solution I have is not a proper one, but I have seen zero padded numbers on very many supplier documents, and sorting might be the reason. If many people are doing it this way, it might be the right way, better have some input from more experienced Tryton users/developers.

We are all dummies until we understand how something works :slight_smile:

What I did is this:
In Administration / Sequences / Sequences:
Open sequence you are interested in.
In the field Number padding write how many digits you want your number to have. If you expect to create 9999 records, then you should write 4. If the next number is for ex. 10, then the record number will be 0010, this way you can sort correctly as long as you do not exceed 9999.

This of course does not solve the problem for the existing records.
As I said, I am also looking for advice from more experienced users/developers.

Issue created.

This has always been the case.

Well usually it is the post number that keep the chronological order which is the default order.

Then the solution is to just unsort the list and it will be in chronological order.
First time you click the column it sorts ascending, then descending, and the third it removes sorting.

Interesting! - How can I “unsort” the list?

Click on the same column more times until it is no longer sorted by that column

That problem happens everywhere a sequence is used.

For example, invoices are sorted by alphabetical order of the invoice number when the list is not sorted by a column. So in my list of client invoices, I have FAC2022-5x (x from 9 to 0), then FAC2022-5, then FAC2022-4x,… I could pad the numbers, but that’s bad design: what happens if/when I overflow ?

And if I sort by a column, say date for example, all the invoices for the same date are randomly arranged.

I think that sequence columns should be sorted alphabetically on the prefix, then numerically on the increment.

For the record I submitted Issue 11638: Order first by lenght field filled by sequence - Tryton issue tracker which should fix simple cases for all modules.
I also closed Issue 9344: sorting payment groups by number needs to sort numerically - Tryton issue tracker because it will be soon possible to use a default ICU global locale provider to PostgreSQL which could be used for those who wants to have special order for numeric char.

1 Like