Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 56 additions & 21 deletions export_async_schedule/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ Scheduled Asynchronous Export

|badge1| |badge2| |badge3| |badge4| |badge5|

Add a new Automation feature: Scheduled Exports. Based on an export list
and a domain, an email is sent every X hours/days/weeks/months to a
selection of users.
Schedule automated exports sent by email at regular intervals (hours,
days, weeks, months) to selected users.

**Export Groups** allow bundling multiple exports into a single email
with multiple attachments - useful for consolidated reporting.

**Table of contents**

Expand All @@ -40,32 +42,62 @@ selection of users.
Configuration
=============

The configuration of a scheduled export is based on export lists.
Creating an Export List
-----------------------

To create an export list:
1. Open any model's list view (e.g., Partners, Sales Orders)
2. Select at least one record
3. Click **Action → Export**
4. Select fields to export
5. Save the field list with a meaningful name

- open the list view of the model to export
- select at least one record, and open "Action → Export"
- select the fields to export and save using "Save fields list".
Configuring a Scheduled Export
------------------------------

To configure a scheduled export:
Navigate to **Settings → Technical → Automation → Scheduled Exports**
and create a new record with:

- open "Settings → Technical → Automation → Scheduled Exports"
- create a scheduled export by filling the form
- Model and export list (created above)
- Export domain (filter records to export)
- Export format (CSV or Excel)
- Recipients (users who will receive the export)
- Schedule (frequency and next execution date)
- Language (for field labels in the export)

A Scheduled Action named "Send Scheduled Exports" checks every hour if
Scheduled Exports have to be executed.
A cron job runs hourly to execute scheduled exports and groups.

Usage
=====

When the configuration of a Scheduled Export is done, their execution is
automatic.
When a scheduled export is configured, its execution is automatic based
on the schedule.

Users receive an email with a download link for the exported file.
Attachments remain in the database for 7 days by default (configurable
via the ``attachment.ttl`` system parameter).

Export Groups
-------------

Group multiple exports into a single email:

1. Navigate to **Settings > Technical > Automation > Grouped Scheduled
Exports**
2. Create a group specifying:

- Recipients (users with email addresses)
- Email template
- Exports to include (select from standalone exports or create new
ones)
- Schedule (interval, next execution, language)

3. Use **Send Test Email Now** to verify configuration

Users will receive an email containing a link to download the exported
file at the specified frequency. The attachments stay in the database
for 7 days by default (it can be changed with the system parameter
``attachment.ttl``.
**Important**: When an export is added to a group, it automatically
inherits the group's scheduling parameters (recipients, interval,
language, etc.). Individual exports within a group cannot be executed
separately - only the group's cron job triggers their execution as a
batch.

Known issues / Roadmap
======================
Expand Down Expand Up @@ -132,10 +164,13 @@ promote its widespread use.
.. |maintainer-guewen| image:: https://github.com/guewen.png?size=40px
:target: https://github.com/guewen
:alt: guewen
.. |maintainer-stephanemangin| image:: https://github.com/stephanemangin.png?size=40px
:target: https://github.com/stephanemangin
:alt: stephanemangin

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-guewen|
|maintainer-guewen| |maintainer-stephanemangin|

This module is part of the `OCA/queue <https://github.com/OCA/queue/tree/17.0/export_async_schedule>`_ project on GitHub.

Expand Down
10 changes: 7 additions & 3 deletions export_async_schedule/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
# Copyright 2019 Camptocamp
# Copyright 2026 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Scheduled Asynchronous Export",
"summary": "Generate and send exports by emails on a schedule",
"version": "17.0.1.0.0",
"version": "17.0.1.1.0",
"author": "Camptocamp, ACSONE SA/NV, Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/queue",
"category": "Generic Modules",
"depends": [
"base_export_async",
"queue_job",
"mail",
],
"data": [
"security/ir.model.access.csv",
"data/mail_template.xml",
"data/ir_cron.xml",
"views/export_async_schedule_group_views.xml",
"views/export_async_schedule_views.xml",
"security/ir.model.access.csv",
],
"installable": True,
"maintainers": ["guewen"],
"maintainers": ["guewen", "stephanemangin"],
"development_status": "Beta",
}
13 changes: 13 additions & 0 deletions export_async_schedule/data/ir_cron.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,17 @@
name="code"
>model.search([('next_execution', '&lt;=', datetime.datetime.now())]).run_schedule()</field>
</record>

<record id="ir_cron_export_async_schedule_group" model="ir.cron">
<field name="name">Send Grouped Scheduled Exports</field>
<field ref="model_export_async_schedule_group" name="model_id" />
<field eval="True" name="active" />
<field name="user_id" ref="base.user_root" />
<field name="interval_number">1</field>
<field name="interval_type">hours</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall" />
<field name="state">code</field>
<field name="code">model._cron_run_scheduled_groups()</field>
</record>
</odoo>
28 changes: 28 additions & 0 deletions export_async_schedule/data/mail_template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="mail_template_export_group" model="mail.template">
<field name="name">Export Group - Scheduled Reporting</field>
<field name="subject">Scheduled Export - {{ object.display_name }}</field>
<field name="model_id" ref="model_export_async_schedule_group" />
<field name="auto_delete" eval="False" />
<field name="body_html" type="html">
<p>Please find attached the scheduled reports: <strong>
<t t-out="object.display_name" />
</strong>.</p>
<p>This email contains the following exports:</p>
<ul>
<t t-foreach="object.export_ids" t-as="export">
<li>
<t t-out="export.ir_export_id.name or export.model_id.name" />
</li>
</t>
</ul>
<br />
<p>
<span
style="color: #808080;"
>This is an automated message, please do not reply.</span>
</p>
</field>
</record>
</odoo>
2 changes: 2 additions & 0 deletions export_async_schedule/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import export_async_schedule_mixin
from . import export_async_schedule
from . import export_async_schedule_group
Loading
Loading