odoo/odoo · error · UserError

There is no template that applies to invoices.

Error message

There is no template that applies to invoices.

What it means

Raised by account.move._get_available_invoice_template_pdf_report_ids(), which builds the list of PDF report templates available for customer invoices (out_invoice, out_refund, out_receipt). It creates new-record proxies for each outgoing move type and asks _get_available_action_reports() which reports apply. If no report is bound to these move types (no invoice report action enabled), it raises this UserError — typically surfaced when clicking 'Print & Send' / previewing an invoice PDF.

Source

Thrown at addons/account/models/account_move.py:6977

        if self.is_sale_document(include_receipts=True) and self.company_id.account_discount_expense_allocation_id:
            return self.company_id.account_discount_expense_allocation_id
        if self.is_purchase_document(include_receipts=True) and self.company_id.account_discount_income_allocation_id:
            return self.company_id.account_discount_income_allocation_id
        return None

    def _get_available_invoice_template_pdf_report_ids(self):
        """
        Helper to get available invoice template pdf reports
        """
        moves = self

        for move_type in ['out_invoice', 'out_refund', 'out_receipt']:
            moves += self.new({'move_type': move_type})

        available_reports = moves._get_available_action_reports()

        if not available_reports:
            raise UserError(_("There is no template that applies to invoices."))

        return available_reports

    def _is_user_able_to_review(self):
        # If only account is installed, we don't check user access rights.
        return True

    # -------------------------------------------------------------------------
    # TOOLING
    # -------------------------------------------------------------------------

    @api.model
    def _field_will_change(self, record, vals, field_name):
        if field_name not in vals:
            return False
        field = record._fields[field_name]
        if field.type == 'many2one':
            return record[field_name].id != vals[field_name]

View on GitHub (pinned to 1e661df964)

Solutions

  1. Re-enable/recreate the ir.actions.report for invoices: Settings > Technical > Actions > Reports, find 'Invoices' (xml_id account.account_invoices) and set it active with binding for out_invoice/out_refund/out_receipt.
  2. If a custom module replaced the report, verify its ir.actions.report record and binding_model_id/binding_view_types are correct and the module is installed/updated (odoo -u module).
  3. Check for ir.actions.report rows deleted at SQL level — restore from a backup or re-run the module's data loading (update account module).
Defensive patterns

Strategy: validation

Validate before calling

reports = move._get_available_action_reports() if not move.is_purchase_document(include_receipts=True) else move.move_id.line_ids  # cheap probe
# safer: wrap the call
try:
    template_ids = move._get_available_invoice_template_pdf_report_ids()
except UserError:
    template_ids = self.env['ir.actions.report']
if not template_ids:
    _logger.warning('No invoice PDF report configured; skipping print & send')

Try / catch

from odoo.exceptions import UserError
try:
    report_ids = move._get_available_invoice_template_pdf_report_ids()
except UserError as e:
    if 'no template that applies' in str(e):
        report_ids = None  # degrade gracefully: skip PDF attachment
    else:
        raise

Prevention

When it happens

Trigger: Opening the invoice PDF/preview flow when _get_available_action_reports() returns empty for all of out_invoice/out_refund/out_receipt — e.g. the standard 'account.invoice' report action is disabled (report action active=False or deleted), a custom module removed the report binding, or report XML ids were improperly cleaned during migration.

Common situations: Report action deactivated via Settings > Technical > Reports; a module overriding/deleting account.account_invoices without replacing it; botched database migration or cleanup scripts removing ir.actions.report rows; multi-company setups where the report is company-filtered out.

Related errors


AI-assisted analysis of odoo/odoo@1e661df964 (2026-08-15). Data as JSON: /api/errors/682153878682b4eb. Report an issue: GitHub.