Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
      • Get a Tailored Demo
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +32 2 290 34 90
    • Get a Tailored Demo
  • Pricing
  • Help
  1. APPS
  2. Reporting
  3. Py3o Report Engine v 17.0
  4. Sales Conditions FAQ

Py3o Report Engine

by XCG Consulting https://github.com/OCA/reporting-engine , ACSONE SA/NV https://github.com/OCA/reporting-engine , Odoo Community Association (OCA) https://github.com/OCA/reporting-engine
Odoo
v 17.0 Third Party 4152
Download for v 17.0 Deploy on Odoo.sh
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 745
Technical Name report_py3o
LicenseAGPL-3
Websitehttps://github.com/OCA/reporting-engine
Versions 10.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0
You bought this module and need support? Click here!

Py3o Report Engine

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

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.

Table of contents

  • Installation
  • Configuration
    • Configuration parameters
  • Usage
    • Available functions and objects
    • Sample report templates
  • Known issues / Roadmap
  • Bug Tracker
  • Credits
    • Authors
    • Contributors
    • Maintainers

Installation

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

Configuration

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"?>
<odoo>

<record id="account.account_invoices" model="ir.actions.report">
    <field name="report_type">py3o</field>
    <field name="py3o_filetype">odt</field>
    <field name="module">my_custom_module_base</field>
    <field name="py3o_template_fallback">report/account_invoice.odt</field>
</record>

</odoo>

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>
    <!-- Add entry in "Print" drop-down list -->
    <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.

Usage

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 the current user.
  • lang The user’s company’s language as a string (ISO code).
  • b64decode Python’s base64.b64decode.
  • format_multiline_value(string) Generates the ODF equivalent of <br/> and &nbsp; for multiline fields. (ODF is XML internally, so those would be skipped otherwise.)
  • html_sanitize(string) Sanitizes an HTML string.
  • time Python’s time module.
  • display_address(partner) Returns 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) Returns a formatted numeric or monetary value according to the context language and timezone.
  • o_format_date(value, lang_code=False, date_format=False) Returns 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.

Known issues / Roadmap

  • generate barcode ?
  • add more detailed example in demo file to showcase features
  • add migration guide aeroo -> py3o

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • XCG Consulting
  • ACSONE SA/NV

Contributors

  • Florent Aide (XCG Consulting)
  • Laurent Mignon <laurent.mignon@acsone.eu>,
  • Alexis de Lattre <alexis.delattre@akretion.com>,
  • Guewen Baconnier <guewen.baconnier@camptocamp.com>
  • Omar Castiñeira <omar@comunitea.com>
  • Holger Brunn <hbrunn@therp.nl>
  • Phuc Tran Thanh <phuc@trobz.com>

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

This module is part of the OCA/reporting-engine project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with