OdooWiki OCA HUB

Py3o Report Engine

report_py3o folder_open OCA/reporting-engine open_in_new
Reporting License: AGPL-3

The py3o reporting engine is a reporting engine for Odoo based on Libreoffice:

  • the report is created with Libreoffice (ODT or ODS),
  • the report is stored on the server in OpenDocument format (.odt or .ods file)
  • the report is sent to the user in OpenDocument format or in any output format supported by Libreoffice (PDF, HTML, DOC, DOCX, Docbook, XLS, etc.)

The key advantages of a Libreoffice based reporting engine are:

  • no need to be a developer to create or modify a report: the report is created and modified with Libreoffice. So this reporting engine has a full WYSIWYG report development tool!
  • For a PDF report in A4/Letter format, it's easier to develop it with a tool such as Libreoffice that is designed to create A4/Letter documents than to develop it in HTML/CSS, also some print peculiarities (backgrounds, margin boxes) are not very well supported by the HTML/CSS based solutions.
  • If you want your users to be able to modify the document after its generation by Odoo, just configure the document with ODT output (or DOC or DOCX) and the user will be able to modify the document with Libreoffice (or Word) after its generation by Odoo.
  • Easy development of spreadsheet reports in ODS format (XLS output possible).

This module report_py3o is the base module for the Py3o reporting engine. If used alone, it will spawn a libreoffice process for each ODT to PDF (or ODT to DOCX, ..) document conversion. This is slow and can become a problem if you have a lot of reports to convert from ODT to another format. In this case, you should consider the additionnal module report_py3o_fusion_server which is designed to work with a libreoffice daemon. With report_py3o_fusion_server, the technical environnement is more complex to setup because you have to install additionnal software components and run 2 daemons, but you have much better performances and you can configure the libreoffice PDF export options in Odoo (allows to generate PDF forms, PDF/A documents, password-protected PDFs, watermarked PDFs, etc.).

This reporting engine is an alternative to Aeroo: these two reporting engines have similar features but their implementation is entirely different. You cannot use aeroo templates as drop in replacement though, you'll have to change a few details.

auto_awesome What this module does

AI-generated from the code · Odoo 19.0

Lets you build Odoo reports as LibreOffice documents (ODT/ODS/ODP) and print them as PDF, DOC, XLS and other formats. You manage the templates in Odoo and attach them to any report action.

This module adds a new report type called py3o to Odoo. Instead of designing reports in HTML, you create them in LibreOffice and upload the file as a template, so the layout is fully WYSIWYG.

Where it appears: - A new "Py3o Templates" menu under the Reporting menu, where you store templates with a name, a file type (ODF text, spreadsheet, presentation, flat variants) and the LibreOffice file itself. - On any report action (Settings > Technical > Reports), a new "LibreOffice Template" tab appears when the report type is py3o. There you choose the output format, the template, an optional fallback file path, and whether several records should be merged into one report. - A search filter "Py3o Reports" helps find these reports.

Business rules and automatic behaviour: - The output format is mandatory for py3o reports; otherwise Odoo blocks saving with a validation error. - If the chosen output format is not a native LibreOffice format and the LibreOffice runtime cannot be found on the server, a red warning is shown on the report and logged. - When printing several records at once, Odoo normally produces a ZIP with one file per record; the "Multiple Records in a Single Report" option produces one single document instead. PDFs are merged, other formats are zipped. - If the report is configured to save attachments, generated files are stored on the record and reused.

The module touches ir.actions.report, py3o.template and py3o.report, and adds a download route used by the web client.

Depends on

web

Menus it adds

py3o_template_configuration_menu
Models and fields (3)
  • py3o.report · new modelir_actions_report_id
  • py3o.template · new modelname (Template name), filetype (LibreOffice Template File Type), py3o_template_data (LibreOffice Template)
  • ir.actions.report · extends an existing modelmodule, lo_bin_path (Path to the libreoffice runtime), report_type, py3o_filetype (Output Format), py3o_template_id, py3o_multi_in_one (Multiple Records in a Single Report), is_py3o_native_format, py3o_template_fallback (Fallback), is_py3o_report_not_available, msg_py3o_report_not_available

Text generated by AI (DeepSeek) from reading the Odoo 19.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 8 confirmed, 1 with no information of 9 versions.

Sources · Odoo 17.0

Confirmed on 2026-11-03 in branch 17.0 of OCA/reporting-engine.

terminal Installation and usage

OCA documentation · Odoo 19.0

Install the required python libs:

`` pip install py3o.template pip install py3o.formats `To allow the conversion of ODT or ODS reports to other formats (PDF, DOC, DOCX, etc.), install libreoffice: apt-get --no-install-recommends install libreoffice```

For example, to replace the native invoice report by a custom py3o report, add the following XML file in your custom module:

`` <?xml version="1.0" encoding="utf-8"?> py3o odt my_custom_module_base report/account_invoice.odt `where *my_custom_module_base* is the name of the custom Odoo module. In this example, the invoice ODT file is located in *my_custom_module_base/report/account_invoice.odt*.

It's also possible to reference a template located in a trusted path of your Odoo server. In this case you must let the *module* entry empty and specify the path to the template as *py3o_template_fallback*. <?xml version="1.0" encoding="utf-8"?> <odoo> <record id="account.account_invoices" model="ir.actions.report"> <field name="report_type">py3o</field> <field name="py3o_filetype">odt</field> <field name="py3o_template_fallback">/odoo/templates/py3o/report/account_invoice.odt</field> </record> </odoo>``Moreover, you must also modify the Odoo server configuration file to declare the allowed root directory for your py3o templates. Only templates located into this directory can be loaded by py3o report. [options] ... [report_py3o] root_tmpl_path=/odoo/templates/py3o``If you want an invoice in PDF format instead of ODT format, the XML file should look like: <?xml version="1.0" encoding="utf-8"?> <odoo> <record id="account.account_invoices" model="ir.actions.report"> <field name="report_type">py3o</field> <field name="py3o_filetype">pdf</field> <field name="module">my_custom_module_base</field> <field name="py3o_template_fallback">report/account_invoice.odt</field> </record> </odoo>``If you want to add a new py3o PDF report (and not replace a native report), the XML file should look like this: <?xml version="1.0" encoding="utf-8"?> <odoo> <record id="partner_summary_report" model="ir.actions.report"> <field name="name">Partner Summary</field> <field name="model">res.partner</field> <field name="report_name">res.partner.summary</field> <field name="report_type">py3o</field> <field name="py3o_filetype">pdf</field> <field name="module">my_custom_module_base</field> <field name="py3o_template_fallback">report/partner_summary.odt</field> <field name="binding_type">report</field> <field name="binding_model_id" ref="base.model_res_partner"/> </record> </odoo>```

Configuration parameters

py3o.conversion_command The command to be used to run the conversion, libreoffice by default. If you change this, whatever you set here must accept the parameters --headless --convert-to \$ext \$file and put the resulting file into \$file's directory with extension \$ext. The command will be started in \$file's directory.

The templating language is extensively documented, the records are exposed in libreoffice as objects, on which you can also call functions.

Available functions and objects

user Browse record of current user

lang The user's company's language as string (ISO code)

b64decode base64.b64decode

format_multiline_value(string) Generate the ODF equivalent of \ and &nbsp; for multiline fields (ODF is XML internally, so those would be skipped otherwise)

html_sanitize(string) Sanitize HTML string

time Python's time module

display_address(partner) Return a formatted string of the partner's address

o_format_lang(value, lang_code=False, digits=None, grouping=True, monetary=False, dp=False, currency_obj=False, no_break_space=True) Return a formatted numeric or monetary value according to the context language and timezone

o_format_date(value, lang_code=False, date_format=False) Return a formatted date or time value according to the context language and timezone

Sample report templates

Sample py3o report templates for the main Odoo native reports (invoice, sale order, purchase order, picking, etc.) are available on the Github project odoo-py3o-report-templates.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.