Skip to content

[18.0][MIG] base_export_async: migrate - #849

Open
pierre-halleux wants to merge 61 commits into
OCA:18.0from
acsone:18.0-mig-base_export_async
Open

pierre-halleux wants to merge 61 commits into
OCA:18.0from
acsone:18.0-mig-base_export_async

Conversation

@pierre-halleux

Copy link
Copy Markdown

No description provided.

@pierre-halleux pierre-halleux changed the title 18.0 mig base export async [18.0][MIG] base export async Nov 3, 2025
@pierre-halleux pierre-halleux changed the title [18.0][MIG] base export async [18.0][MIG] base_export_async: migrate Nov 3, 2025
@pierre-halleux
pierre-halleux force-pushed the 18.0-mig-base_export_async branch from 49b1330 to af3b019 Compare November 3, 2025 13:09
@pierre-halleux
pierre-halleux force-pushed the 18.0-mig-base_export_async branch from af3b019 to f02ebf1 Compare December 17, 2025 15:24
@sbidoul sbidoul added this to the 18.0 milestone Jan 2, 2026

@samirGuesmi samirGuesmi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @pierre-halleux
Thanks for the PR! 👍 😄
There’s just a small adjustment I’d suggest to avoid the following issue:
TypeError: this.env._t is not a function

@samirGuesmi
samirGuesmi force-pushed the 18.0-mig-base_export_async branch from f02ebf1 to f1cb9fa Compare January 28, 2026 08:37
@RyanTranAVB

Copy link
Copy Markdown

@samirGuesmi I believe your comments are addressed, could you review once again?

@samirGuesmi

Copy link
Copy Markdown
Member

LGTM @pierre-halleux could you please check this and approve the changes

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@pierre-halleux

Copy link
Copy Markdown
Author

LGTM @pierre-halleux could you please check this and approve the changes

Thanks for the changes. LGTM

@fnegrini

Copy link
Copy Markdown

Thanks for this — migrating base_export_async is genuinely needed.
While testing a parallel port of my own (#)
against a live 18.0 instance (42k-row export, real email delivery), I
ran into three issues that also apply to this PR, flagging them here in
case they're useful regardless of which one ends up merging:

  1. No access_token is generated for the attachment
    (export() never calls attachment.generate_access_token(), and the
    built URL has no access_token param). Without it,
    ir.attachment.validate_access() only grants access to the
    attachment's creator with an active session, so the emailed link
    404/403s for the recipient in the common case (different
    device/browser, or not logged in when opening the mail) - even the
    16.0 original only handled this for portal users; this drops it
    entirely, including the test_portal_export test that covered it.

  2. model_description = self.env[model_name]._description stays
    English-only for every recipient, since _description is a raw
    Python class attribute, not a translated field. ir.model.name is
    the translate=True equivalent and can be read with the requesting
    user's lang (already available in params["context"]) to get the
    subject in their language.

  3. if request: request.update_env(user=self.env.user) before
    calling core's unmodified ExcelExport()
    relies on request being
    bound, which is only true because queue_job's default runner
    executes jobs via an internal call to /queue_job/runjob. Under any
    runner/test path where the job executes without a live HTTP request,
    request is unbound, the guard silently no-ops, and
    ExportXlsxWriter.__init__ then fails on request.env[...].
    test_export_xls here sidesteps this by mocking
    ExcelExport.from_data directly, so the real code path isn't
    actually covered.

Happy to fold these directly into this PR instead of keeping mine
separate, whichever you/the maintainers prefer.

Look at: https://github.com/fnegrini/queue_export_assync_18/tree/18.0-mig-base_export_async

@StephaneMangin

Copy link
Copy Markdown

Once merged, there is an optimisation addition proposed here to avoid memory issues for very large exports. #1010.

vincent-cowboy and others added 24 commits October 14, 2026 12:10
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)
@pierre-halleux
pierre-halleux force-pushed the 18.0-mig-base_export_async branch from f1cb9fa to 149a776 Compare October 14, 2026 11:19
@oca-cla-bot

oca-cla-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown

@pierre-halleux

Copy link
Copy Markdown
Author

Thanks a lot @fnegrini for the detailed report.

  1. Access token: The 16.0 fix, "issuing tokens for portal recipients" was merged after I created this branch. I've now forward-ported it in 149a7763. Always issuing a token would change the 16.0 behaviour so I think this should be adressed in a dedicated PR.
  2. Untranslated subject and 3. Request guard: I agree, but these are inherited from 16.0, so should also be handled in a separate PR imo.

Once this is merged, feel free to open those PRs from your branch and ping me. I'm happy to review them.

@pierre-halleux

Copy link
Copy Markdown
Author

@StephaneMangin thanks, very we useful, we did encouter this issue as well previously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.