跳至内容
菜单
此问题已终结
1 回复
172 查看

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!

形象
丢弃
最佳答案

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

形象
丢弃
编写者

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

相关帖文 回复 查看 活动
2
5月 25
1037
0
12月 24
681
0
9月 25
10
3
9月 25
1301
1
9月 25
214