{"record":{"id":"d0f9b2c0202bbeb0","repo":"odoo/odoo","slug":"the-sending-of-invoices-is-not-set-up-properly-ma","errorCode":null,"errorMessage":"The sending of invoices is not set up properly, make sure the report used is set for invoices.","messagePattern":"The sending of invoices is not set up properly, make sure the report used is set for invoices\\.","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"addons/account/models/account_move_send.py","lineNumber":353,"sourceCode":"\n    @api.model\n    def _get_move_constraints(self, move):\n        constraints = {}\n        if move.state != 'posted':\n            constraints['not_posted'] = _(\"You can't generate invoices that are not posted.\")\n        if not move.is_sale_document(include_receipts=True):\n            constraints['not_sale_document'] = _(\"You can only generate sales documents.\")\n        return constraints\n\n    @api.model\n    def _check_invoice_report(self, moves, **custom_settings):\n        if ((\n                custom_settings.get('pdf_report')\n                and any(not move._is_action_report_available(custom_settings['pdf_report']) for move in moves)\n            )\n            or any(not self._get_default_pdf_report_id(move).is_invoice_report for move in moves)\n        ):\n            raise UserError(_(\"The sending of invoices is not set up properly, make sure the report used is set for invoices.\"))\n\n    @api.model\n    def _format_error_text(self, error):\n        \"\"\" Format the error that can be a dict (complex format needed)\n\n        :param error: the error to format.\n        :return: a text formatted error.\n        \"\"\"\n        errors = '\\n- '.join(error.get('errors', ''))\n        return f\"{error['error_title']}\\n- {errors}\" if errors else error['error_title']\n\n    @api.model\n    def _format_error_html(self, error):\n        \"\"\" Format the error that can be a dict (complex format needed)\n\n        :param error: the error to format.\n        :return: a html formatted error.\n        \"\"\"","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/odoo/odoo/blob/1e661df964b1b264c9cef3ab28430d4785be3fda/addons/account/models/account_move_send.py#L335-L371","documentation":"_check_invoice_report guards the send/generate flow: it fails when a report passed via custom_settings['pdf_report'] is not available for one of the moves, or when the resolved default report does not have is_invoice_report True. The point is that invoice sending must use a report declared as an invoice report (correct model and paperformat binding).","triggerScenarios":"Calling account.move.send actions with custom_settings {'pdf_report': some_report} where some_report is unavailable for a move, or default template resolution (see error 135) returning a report with is_invoice_report False — e.g. a generic document report bound to another model.","commonSituations":"Integrations passing an arbitrary ir.actions.report id to the send wizard; custom PDF report modules that forget to set the invoice report flag / binding model account.move; mixing refund or delivery-slip reports into invoice sending.","solutions":["Pass a proper invoice report: verify report.is_invoice_report and report.model == 'account.move' before using it in custom_settings.","Fix the custom report definition so it is registered as an invoice report (binding_model_id account.move / is_invoice_report), then re-run the send.","If no explicit report is wanted, clear the wrong pdf_report from custom_settings and let defaults resolve."],"exampleFix":"// before\nsettings = {'pdf_report': generic_report}  # not an invoice report\nsend._send_invoice(move, **settings)\n\n// after\nassert generic_report.is_invoice_report and generic_report.model == 'account.move'\nsettings = {'pdf_report': generic_report}\nsend._send_invoice(move, **settings)","handlingStrategy":"validation","validationCode":"report = custom_settings.get('pdf_report') or env['account.move.send']._get_default_pdf_report_id(move)\nassert report.is_invoice_report and all(move._is_action_report_available(report) for move in moves)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Whitelist reports in integrations: model 'account.move' + is_invoice_report True.","Test the send wizard after any report customization.","Do not pass generic document reports into invoice sending."],"tags":["accounting","odoo","pdf-report","validation","invoicing"],"backgroundTag":null,"analyzedSha":"1e661df964b1b264c9cef3ab28430d4785be3fda","analyzedAt":"2026-08-15T05:22:16.142Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}