You added a service statement to your invoice email template. Good idea, until the day a customer receives, with the invoice for their stove, an empty service statement. Odoo attaches the “dynamic reports” of an email template at every sending, without any condition. Here is why, where the setting Odoo ignores lives, and the free module I wrote so that it is finally respected.
1. The symptom: a PDF with nothing to say
An Odoo email template can carry dynamic reports: PDFs printed when the email is sent and attached automatically. It is handy to send, with the invoice, a timesheet, a certificate or special terms.
The problem: Odoo prints and attaches all of them, every time. An invoice for goods leaves with an empty service statement; a service order with a delivery slip without lines. When sending one by one, you can remove the attachment by hand. In batch or automated sending, nobody does.
💡 Key takeaway
A report attached to an email never looks at the document it goes with: everything leaves, always.
2. The setting exists, but sending ignores it
Every Odoo report has a Domain field (“Filter domain”): a condition that says for which records the report makes sense. It is read by the Print menu, and only by it: a report whose domain excludes the document does not show up there.
I checked in the code of Odoo 19 and Odoo 20: the attachments of an email template
(mail.template) and the invoice Send wizard (account.move.send) go through
the list of reports without ever reading that domain. In Odoo 19 the field is not
even visible on the report form until Invoicing is installed; Odoo 20 shows it in the Visibility tab.
💡 Key takeaway
No need for a new setting: the report domain already says when it is useful. Sending only has to respect it.
3. The solution: Conditional Email Reports
The Conditional Email Reports module applies the report domain at sending time, with the same rule as the Print menu:
- for every email sent from a template (chatter, mass mailing, automated actions);
- in the invoice Send wizard, one by one and in batch, thanks to a small companion module that installs itself with Invoicing;
- in Odoo 19 without Invoicing, the domain field is added to the report form.
Example: a service statement with the domain [('invoice_line_ids.product_id.type', '=',
'service')]. The invoice for a stove alone leaves with the invoice, full stop. The invoice for
the stove and its four hours of installation leaves with the statement.
💡 Key takeaway
One setting, already known to your users, decides both printing and sending.
4. The trade-offs, stated
A wrong domain blocks saving, not sending. The domain now decides what reaches your customers: a domain that cannot be evaluated is refused as soon as the report is saved, with the error. Reports shipped by modules are not checked when they are installed, so that an update is never blocked.
The cost does not depend on the number of invoices. Each domain is evaluated once for the whole batch, then each invoice is a simple test in memory. On a batch of 200 invoices, that is one evaluation per report, not 200.
Compatible with my other module. If you use Mail Composer PDF Reuse, which avoids printing the same PDF again at every template change, a bridge installs itself so that each reused PDF stays linked to the right report.
💡 Key takeaway
22 tests, green on Odoo 19 and 20, Community and Enterprise: invoice with and without data, single and batch sending, invalid domain.
⚔️ The Match: standard Odoo vs Conditional Email Reports
| Criterion | Standard Odoo 19 / 20 | With Conditional Email Reports |
|---|---|---|
| Report with nothing to show for this document | Attached anyway (empty PDF) | Neither printed nor attached |
| Batch sending of invoices | Every report, everywhere | Following the domain, invoice by invoice |
| Setting | Domain read by the Print menu only | The same domain, at sending time too |
| Invalid domain | Accepted without check | Refused when saved |
Checked on Odoo 19 and 20, Community and Enterprise, demo database with two fictitious invoices (goods only; goods and installation hours).
The Verdict: the right document, to the right customer, without thinking about it
The module is free, under the LGPL-3 licence, for Odoo 19 and 20:
Conditional Email Reports.
Do your email templates really send what your customers expect? Let’s talk about it during an
Odoo audit.
You added a service statement to your invoice email template. Good idea, until the day a customer receives, with the invoice for their stove, an empty service statement. Odoo attaches the “dynamic reports” of an email template at every sending, without any condition. Here is why, where the setting Odoo ignores lives, and the free module I wrote so that it is finally respected.
1. The symptom: a PDF with nothing to say
An Odoo email template can carry dynamic reports: PDFs printed when the email is sent and attached automatically. It is handy to send, with the invoice, a timesheet, a certificate or special terms.
The problem: Odoo prints and attaches all of them, every time. An invoice for goods leaves with an empty service statement; a service order with a delivery slip without lines. When sending one by one, you can remove the attachment by hand. In batch or automated sending, nobody does.
💡 Key takeaway
A report attached to an email never looks at the document it goes with: everything leaves, always.
2. The setting exists, but sending ignores it
Every Odoo report has a Domain field (“Filter domain”): a condition that says for which records the report makes sense. It is read by the Print menu, and only by it: a report whose domain excludes the document does not show up there.
I checked in the code of Odoo 19 and Odoo 20: the attachments of an email template
(mail.template) and the invoice Send wizard (account.move.send) go through
the list of reports without ever reading that domain. In Odoo 19 the field is not
even visible on the report form until Invoicing is installed; Odoo 20 shows it in the Visibility tab.
💡 Key takeaway
No need for a new setting: the report domain already says when it is useful. Sending only has to respect it.
3. The solution: Conditional Email Reports
The Conditional Email Reports module applies the report domain at sending time, with the same rule as the Print menu:
- for every email sent from a template (chatter, mass mailing, automated actions);
- in the invoice Send wizard, one by one and in batch, thanks to a small companion module that installs itself with Invoicing;
- in Odoo 19 without Invoicing, the domain field is added to the report form.
Example: a service statement with the domain [('invoice_line_ids.product_id.type', '=',
'service')]. The invoice for a stove alone leaves with the invoice, full stop. The invoice for
the stove and its four hours of installation leaves with the statement.
💡 Key takeaway
One setting, already known to your users, decides both printing and sending.
4. The trade-offs, stated
A wrong domain blocks saving, not sending. The domain now decides what reaches your customers: a domain that cannot be evaluated is refused as soon as the report is saved, with the error. Reports shipped by modules are not checked when they are installed, so that an update is never blocked.
The cost does not depend on the number of invoices. Each domain is evaluated once for the whole batch, then each invoice is a simple test in memory. On a batch of 200 invoices, that is one evaluation per report, not 200.
Compatible with my other module. If you use Mail Composer PDF Reuse, which avoids printing the same PDF again at every template change, a bridge installs itself so that each reused PDF stays linked to the right report.
💡 Key takeaway
22 tests, green on Odoo 19 and 20, Community and Enterprise: invoice with and without data, single and batch sending, invalid domain.
⚔️ The Match: standard Odoo vs Conditional Email Reports
| Criterion | Standard Odoo 19 / 20 | With Conditional Email Reports |
|---|---|---|
| Report with nothing to show for this document | Attached anyway (empty PDF) | Neither printed nor attached |
| Batch sending of invoices | Every report, everywhere | Following the domain, invoice by invoice |
| Setting | Domain read by the Print menu only | The same domain, at sending time too |
| Invalid domain | Accepted without check | Refused when saved |
Checked on Odoo 19 and 20, Community and Enterprise, demo database with two fictitious invoices (goods only; goods and installation hours).
The Verdict: the right document, to the right customer, without thinking about it
The module is free, under the LGPL-3 licence, for Odoo 19 and 20:
Conditional Email Reports.
Do your email templates really send what your customers expect? Let’s talk about it during an
Odoo audit.