Skip to Content
Menu
This question has been flagged
3 Replies
4452 Views

Hello.

I need to export data from invoices by sequence. The list view  of invoices doesn't have a sequence ordering column, so I searched for another view with sequece column and I found the journals view. There I exported the data, then I reordered it by sequence but after I exported again both .xls documents show the data in the same order. 

I really need to find out how to export the data by sequence order. I would appreciate your help.

Avatar
Discard
Best Answer

I had the same problem. I had to export a large number of invoices, sorted by number.

I was not able doing that from UI.

I had to patch the file addons/web/main.py, class ExportFormat, method base(), from


    records = Model.browse(ids) or Model.search(domain, offset=0, limit=False, order=False)

to


    if ids:
            ids=sorted(ids)
    records = Model.browse(ids) or Model.search(domain, offset=0, limit=False, order="id asc")


Instead of "id asc" you may try "number asc" or "name asc".

Of course this patch impacts on all exports not only invoices

Avatar
Discard
Best Answer

I had a similar problem where I was exporting journal entries together with journal items. I first sorted the data on the screen by date. However, when I exported the sort was not applied. Since there were several rows with fields without any data (parent/child record), it was impossible to sort it on excel. 

To overcome the problem, I used group by date and number. When I did this, the resulting excel showed me data sorted on both fields.

I hope it helps.


Avatar
Discard
Best Answer

The most accurate field to sort data is Database ID field. You can select to export all data to be able add it to the exported fields. So, you will be able to sort data using this column.


Avatar
Discard
Related Posts Replies Views Activity
3
Apr 15
9002
0
Dec 24
852
0
Sep 24
1359
2
Mar 24
2982
2
Feb 23
3539