Repository navigation
[18.0][IMP] MemoryError failures for big exports - #1010
Open
StephaneMangin wants to merge 61 commits into
Open
StephaneMangin wants to merge 61 commits into
StephaneMangin wants to merge 61 commits into
Conversation
…achment to a record only visible to the user
Currently translated at 100.0% (19 of 19 strings) Translation: queue-12.0/queue-12.0-base_export_async Translate-URL: https://translation.odoo-community.org/projects/queue-12-0/queue-12-0-base_export_async/de/
Currently translated at 100.0% (19 of 19 strings) Translation: queue-12.0/queue-12.0-base_export_async Translate-URL: https://translation.odoo-community.org/projects/queue-12-0/queue-12-0-base_export_async/zh_Hans/
The UI still send it to the current user, but it will allow reusing the module for other purposes: plan a regular export to users. Setting the recipient_ids instead of the email_to in mail.mail means that we can still send the email, it will stay in the failed emails, allowing to correct the user.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: queue-12.0/queue-12.0-base_export_async Translate-URL: https://translation.odoo-community.org/projects/queue-12-0/queue-12-0-base_export_async/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: queue-15.0/queue-15.0-base_export_async Translate-URL: https://translation.odoo-community.org/projects/queue-15-0/queue-15-0-base_export_async/
Currently translated at 100.0% (22 of 22 strings) Translation: queue-16.0/queue-16.0-base_export_async Translate-URL: https://translation.odoo-community.org/projects/queue-16-0/queue-16-0-base_export_async/es/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: queue-16.0/queue-16.0-base_export_async Translate-URL: https://translation.odoo-community.org/projects/queue-16-0/queue-16-0-base_export_async/
Currently translated at 100.0% (22 of 22 strings) Translation: queue-16.0/queue-16.0-base_export_async Translate-URL: https://translation.odoo-community.org/projects/queue-16-0/queue-16-0-base_export_async/it/
Currently translated at 100.0% (22 of 22 strings) Translation: queue-16.0/queue-16.0-base_export_async Translate-URL: https://translation.odoo-community.org/projects/queue-16-0/queue-16-0-base_export_async/it/
Currently translated at 100.0% (22 of 22 strings) Translation: queue-16.0/queue-16.0-base_export_async Translate-URL: https://translation.odoo-community.org/projects/queue-16-0/queue-16-0-base_export_async/fr/
As normal user only have read access to delay.export, we need sudo to chreate an attachment on this record Use user 6 (Marc Demo) in the tests, not admin (2)
… and batches Reuse of methods implemented odoo/odoo#257333. Make export_data works by batches of PREFETCH_MAX, and invalidate the whole cache between batches to also drop the related records. The export writer keeps the workbook in memory only (which could leads to memoryError failures with big exports): use of the constant_memory mode of xlsxwriter which flushes each row to a temporary file.
|
The following commit authors need to sign the Contributor License Agreement: |
StephaneMangin
deleted the
18.0-imp-base_export_async-memory_optimisation-smn
branch
October 14, 2026 08:03
StephaneMangin
restored the
18.0-imp-base_export_async-memory_optimisation-smn
branch
October 14, 2026 08:03
StephaneMangin
marked this pull request as ready for review
October 14, 2026 08:29
pierre-halleux
approved these changes
Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #849, the last commit to review for this PR.
Large asynchronous export fails with a
MemoryError, what's implemented:export_databy batches ofPREFETCH_MAXand cache invalidation between batches (as [PERF] report: batch the export_data calls during data exports odoo/odoo#257333 does for the web export);Benchmarks
Fake partners (8 fields including a many2many):
Real case
33,557 invoices exported in xlsx, peak memory of the process (Odoo default limits: 2,048 MiB soft, 2,560 MiB hard):
The xlsx export now uses temporary files (about twice the uncompressed sheet, removed once exported).