Skip to Content
Menu
This question has been flagged
1 Odpoveď
141 Zobrazenia

I am facing performance issues when trying to print custom accounting reports to Excel. These reports cover a significant amount of data, typically spanning 6 months. Despite having the server running on 2 workers in Odoo.sh, the server occasionally crashes during this process.

I am unsure if I should focus on optimizing the code to handle the export process more efficiently or if there is a better approach for viewing and handling these accounting reports.

Could anyone share insights or best practices on how to handle large datasets in accounting reports? Should I look into code optimizations, or are there alternative methods for efficiently accessing and exporting these reports?

Thank you for your advice!

Avatar
Zrušiť
Best Answer

Hi,


Your server crashes because generating large Excel reports synchronously overloads worker memory and CPU. To fix this, focus on two solutions:


1- Optimize the Code: Replace slow ORM calls with efficient raw SQL queries in the report's data-fetching method. This lets the database handle the heavy lifting.


2- Change the Process: Implement asynchronous reporting. Use the queue_job module to generate reports in the background. Users get a notification with a download link when the file is ready, preventing server timeouts and crashes.


For immediate relief, encourage users to filter data and view reports as PDFs before exporting to Excel. The long-term, most effective solution is to adopt asynchronous processing.


Hope it helps

Avatar
Zrušiť
Autor

Thank you for answering queue_job might be the answer I am looking for

Related Posts Replies Zobrazenia Aktivita
2
máj 25
1037
0
dec 24
675
4
sep 25
1228
1
sep 25
176
2
sep 25
582