Search 1.9 billion lines of Odoo code on GitHub

report_py3o

Author: XCG Consulting,Odoo Community Association (OCA)
License: AGPL-3
Branch: 9.0-report_py3o_xls_tbi
Repository: acsone/reporting-engine
Dependencies: base, and report
Languages: PO File (71, 11.0%), Python (481, 74.2%), and XML (96, 14.8%)
Other branches: 10-cmis_report_write_compat-lmi, 10.0, 10.0-alf_master, 10.0-backport-report_csv-lmi, 10.0-brb_master, 10.0-crd_master, 10.0-oba_master, 10.0-py3o_template_multilang-lmi, 10.0-py3o_template_selection_modularity-lmi, 10.0-refactor_py3o-jne, 10.0-refactor_py3o_bis-jne, 10.0-report_py3o_print_report_name-lmi, 12.0, 12.0-prg_master, 12.0-ref_report_py3o_python_3.9-mle, 12.0-report_substitute_generate_email-qgr, 13.0, 13.0-imp_report_qweb_signer_allowed_reports_tbi, 13.0-mig-report_py3o_multilang, 13.0-mig_report_substitute, 13.0-ref_report_py3o_python_3.11_tbi, 13.0-report_qweb_element_page_visibility, 13.0-slg_master, 14.0, 14.0-imp_report_qweb_signer_allowed_reports_tbi, 14.0-mig-report_py3o, 14.0-update-dotfiles-sbi, 9.0-import_report_py3o, 9.0-refactor_py3o-lmi, 9.0-refactor_py3o_bis-lmi, 9.0-refactor_py3o_controller-lmi, 9.0-report_py3o, 9.0-report_py3o_custom_filename-lmi, 9.0-slg_master, add-report_py3o_signer-lco, and imp-temp-remove-java-in-manifest-lco
Other repositories: 001101/reporting-engine, AITIC/reporting-engine, Aabcrow/reporting-engine, AcruxLab/reporting-engine, AdriaGForgeFlow/reporting-engine, Ahmad-Hamouda/reporting-engine, Albin-John/reporting-engine, Alfa-90/reporting-engine, App247/reporting-engine, AsierSV/reporting-engine, Axon-System/reporting-engine, Bubbles-IT/reporting-engine, CB-Gran-Canaria/reporting-engine, CGenie/reporting-engine, CMR-tetra/reporting-engine, Cayprol/reporting-engine, Change2improve/reporting-engine, ClancyQiao/reporting-engine, ClearCorp/oca-reporting-engine, ComitorDevTeam/reporting-engine, Comunitea/reporting-engine, DamonLiu0814/reporting-engine, Darknroses/reporting-engine, Digital5-Odoo/reporting-engine, Dobtor-OCA/reporting-engine, Domatix/reporting-engine, DudhatShivam/reporting-engine, EBII/reporting-engine, ERPLibre/reporting-engine, EssentNovaTeam/reporting-engine, Fitranugraha/reporting-engine, ForgeFlow/reporting-engine, Gabinete-Digital/reporting-engine, Glue-Software-Engineering-AG/reporting-engine, Gofekra/reporting-engine, GrupoAlvamex/reporting-engine, Guobower/reporting-engine, Hamza-Talibi/reporting-engine, HarshalBhoir/reporting-engine, HomerDeoDatu/reporting-engine, IJOL/reporting-engine-1, Infinityloopsistemas/reporting-engine, Ingeos/reporting-engine, Jarsa/reporting-engine, JasonJun1/reporting-engine, Jeisonpernia/reporting-engine, JoJoJoJoJoJoJo/reporting-engine, Kayuulab/reporting-engine, KonosCL/reporting-engine, LeGittan/reporting-engine, Leuan12/reporting-engine, Maartincm/reporting-engine, MadsackMediaStore/reporting-engine, MathBenTech/reporting-engine, Mefistous/reporting-engine, NachoAlesLopez/reporting-engine, NeatNerdPrime/reporting-engine, NextERP-Romania/reporting-engine, Noviat/reporting-engine, Nubeo-be/reporting-engine, OCA-MUK/reporting-engine, OCA/reporting-engine, ORETEK/reporting-engine, OpenCode/reporting-engine, OutillageStEtienne/reporting-engine, Palpid/reporting-engine, PrenorSistemas/reporting-engine, QD-odoo/reporting-engine, QubiQ/reporting-engine, Rad0van/reporting-engine, RealSolutionsLux/reporting-engine, SHEFFIELDAFRICA/reporting-engine, SanteLibre/reporting-engine, Saran440/reporting-engine, SequarSrl/reporting-engine, SerpentConsultingServices/reporting-engine, SeuMarco/reporting-engine, ShakirMemon786/reporting-engine, SimoRubi/reporting-engine, SolutionSeekers/reporting-engine, SportPursuit/reporting-engine, StefanRijnhart/reporting-engine, Studio73/reporting-engine, Syci-Consulting/reporting-engine, TRESCLOUD/reporting-engine, Tatider/reporting-engine, Tecnativa/reporting-engine, TemosEngenharia/reporting-engine, Tonow-c2c/reporting-engine, VanMoof/reporting-engine, Vauxoo/reporting-engine, VisiionSolucionesTecnologicas/reporting-engine, VitalPet/reporting-engine, WilldooIT/reporting-engine, Zhouhao12345/reporting-engine, Zio-Overload/reporting-engine, aaltinisik/reporting-engine, abgfbr/report_py3o, abs44/reporting-engine, acsone/report_py3o, adhoc-dev/oca-reporting-engine, ajaychauhan727/reporting-engine, ajinvn2019/reporting-engine, akretion/report_py3o, akretion/reporting-engine, akshayksolves/reporting-engine, alesisjoan/reporting-engine, alessavindell/reporting-engine, alexlafalce/reporting-engine, algiopensource/reporting-engine, allanaguilar/reporting-engine, amendoncabh/reporting-engine, andhit-r/reporting-engine, anhvu-sg/reporting-engine, anos4444/reporting-engine, apachesep/reporting-engine, apertoso/reporting-engine, apetbiz/reporting-engine, aravinthu/reporting-engine, aremili/reporting-engine, arfie/reporting-engine, aroodooteam/reporting-engine, atonaltzin/reporting-engine, augustynr/reporting-engine, aurestic/reporting-engine, avoinsystems/reporting-engine, bacgdev/reporting-engine, bacgroup/reporting-engine, bealdav/reporting-engine, beenhere4hours/reporting-engine, bishalgit/reporting-engine, blooparksystems/reporting-engine, bmya/reporting-engine-1, brain-tec/reporting-engine, budisentosa/reporting-engine, camptocamp/reporting-engine, cataclysmic/reporting-engine, chenjingxiong/reporting-engine, christophe-hanon/reporting-engine, ciel-it/reporting-engine, cogitoweb/reporting-engine, coopiteasy/reporting-engine, damendieta/reporting-engine, dani-xtendoo/reporting-engine, daramousk/reporting-engine, darshan-odoo/reporting-engine, dcorio/reporting-engine, ddico/reporting-engine, detian08/reporting-engine, dev00007/reporting-engine, diegobgl/reporting-engine, dominiquekonsuntack/reporting-engine, dong-z/reporting-engine, dorsaf/reporting-engine, druidoo-dev/reporting-engine, dupski/reporting-engine, ecosoft-odoo/reporting-engine, eezee-it/reporting-engine, elperrofarelo/reporting-engine, enocare/reporting-engine, etobella/reporting-engine, exosoftware/oca-reporting-engine, ezodoo/reporting-engine, fabiomix/reporting-engine, faide/reporting-engine, fateenvoy/reporting-engine, fauzi-tsani/reporting-engine, feriosvega/reporting-engine, flachica/reporting-engine, fmdl/reporting-engine, frankchongli/odoo-alt-reporting-engine, fugui0310/reporting-engine, gaanto/reporting-engine, gastonfeng/reporting-engine, gbertolani/reporting-engine, gdgellatly/reporting-engine, germanponce/reporting-engine, gonza3001/reporting_engine, govorushagreat/reporting-engine, goyugo/reporting-engine, grap/reporting-engine, guewen/reporting-engine, gurneyalex/reporting-engine, hanelsofterp/reporting-engine, haroldtamo/reporting-engine, hbrunn/reporting-engine, hendrixcosta/report_py3o, henrycoding/reporting-engine, hippe-67/reporting-engine, hisyam44/reporting-engine, hmrodrigues/reporting-engine, holgedchen/reporting-engine, iamyeonhan/reporting-engine, ifadhf/reporting-engine, ilyasProgrammer/reporting-engine, initOS/reporting-engine, it-projects-llc/reporting-engine, izzihector/reporting-engine, j209/reporting-engine, jacky82669513/reporting-engine, jaferrer/reporting-engine, jarroyomorales/reporting-engine, jason156/reporting-engine, jesusVMayor/reporting-engine, jffernandez/reporting-engine, jlzhou/reporting-engine, jnaudon/reporting-engine, johnbendi/reporting-engine, julenalgios/reporting-engine, kararaMohamed/reporting-engine, kenzey0man/reporting-engine, kevin070982/reporting-engine, khaeusler/reporting-engine, kittiu/reporting-engine, kmee/reporting-engine, kongrattapong/reporting-engine, kos94ok-3D/reporting-engine, lbvisperas/reporting-engine, leemannd/reporting-engine, legalsylvain/reporting-engine, leonidasthe300/reporting-engine, libregob/reporting-engine, lideritjnma/reporting-engine, limingsichuan/reporting-engine, lintoct/reporting-engine, luc-demeyer/reporting-engine, lweiming/reporting-engine, maherjaballi/reporting-engine, matrixise/reporting-engine, max1314/reporting-engine, michaelgg84/reporting-engine, minhhq09/reporting-engine, minorisa/reporting-engine, mivilsoft/reporting-engine, mjavint/reporting-engine, modoolar/reporting-engine, mohamed-helmy/reporting-engine, mohamedhagag/reporting-engine-1, multidadosti-erp/reporting-engine, mwithi/reporting-engine, myceliandre/reporting-engine, myonnet/oca-reporting-engine, nabima/reporting-engine, nicolasjelincic/reporting-engine, ninetynineplus/reporting-engine, niulinlnc/reporting-engine, njeudy/reporting-engine, novawish/reporting-engine, nucleoosystem/reporting-engine, odof/reporting-engine, odoogap/reporting-engine, odoonz/reporting-engine, one2pret/reporting-engine, onesteinbv/reporting-engine, onurugur/reporting-engine, oondeo/reporting-engine, osanchezm/reporting-engine, ovnicraft/reporting-engine, p-tombez/reporting-engine, pasgou/reporting-engine, paulvermeulen/reporting-engine, piensom/reporting-engine, pnajman-modoolar/reporting-engine, popcomputadores-desenv/reporting-engine, praxigento/oca-reporting-engine, ps-tubtim/reporting-engine, pscloud/reporting-engine, puchisco/reporting-engine, pythoner-3k/reporting-engine, rachmataditiya/reporting-engine, reservationpartnerlt/reporting-engine, richard-willdooit/reporting-engine, robertsvx27/reporting-engine, robin5210/reporting-engine, royalline1/reporting-engine-1, rrgaona/reporting-engine, rsullivan2704/reporting-engine, ruben-tonetto/reporting-engine, rwsdigital/reporting-engine, sacodoo/reporting-engine, sacostaylara/reporting-engine, saif-serpentcs/reporting-engine, samnimri/reporting-engine, sandreanybox/reporting-engine, sansirit/reporting-engine, sanube/reporting-engine, schout-it/reporting-engine, sekhsokh/reporting-engine, sendalpegat/reporting-engine, sergiocorato/reporting-engine, serpentcs-dev1/reporting-engine, sewisoft/reporting-engine, sgheller/reporting-engine, shiftctrl-io/reporting-engine, shouyejing/report_py3o, simahawk/reporting-engine, soeethiha/reporting-engine, solvosci/reporting-engine, somiderventa/reporting-engine, songpon/reporting-engine, steingabelgaard/reporting-engine, sunflowerit/reporting-engine, superkaja/reporting-engine, suwatuanp/reporting-engine, syci/reporting-engine, takinobori/oca-reporting-engine, tbaden/reporting-engine, tegin/reporting-engine, thandokazi/reporting-engine, thomaspot/reporting-engine, tirma-sa/reporting-engine, trobz/reporting-engine, tsengel2/reporting-engine, tuanna7593/reporting-engine, unitek-solusi/OCA-reporting-engine, ursais/reporting-engine, valmarnet/reporting-engine, vdedyukhin/reporting-engine, versada/reporting-engine, vertelab/odoo-l10n_se, vikichavada/reporting-engine, wahello/reporting-engine, wuhuizhong/reporting-engine, xcgd/report_py3o, xcgd/reporting-engine, xhair/reporting-engine, xwh123807/reporting-engine, yelizariev/reporting-engine, ygdmxy/reporting-engine, zarumaru/reporting-engine, zeroincombenze/reporting-engine, zhaohuaw/reporting-engine, and zohaibrehman/reporting-engine

<a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.svg"> </a> <a name="report-py3o"></a> <h2>Report Py3o</h2> <p>The py3o reporting engine is a reporting engine for Odoo based on <a class="reference external" href="http://www.libreoffice.org/">Libreoffice</a>:</p> <ul class="simple"> <li>the report is created with Libreoffice (ODT or ODS),</li> <li>the report is stored on the server in OpenDocument format (.odt or .ods file)</li> <li>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.)</li> </ul> <p>The key advantages of a Libreoffice based reporting engine are:</p> <ul class="simple"> <li>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!</li> <li>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.</li> <li>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.</li> <li>Easy development of spreadsheet reports in ODS format (XLS output possible).</li> </ul> <p>This reporting engine is an alternative to <a class="reference external" href="https://github.com/aeroo-community/aeroo_reports">Aeroo</a>: 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.</p> <a name="installation"></a> <h3>Installation</h3> <p>Install the required python libs:</p> <pre class="code"> <code class="code">pip install py3o.template pip install py3o.formats</code> </pre> <p>To allow the conversion of ODT or ODS reports to other formats (PDF, DOC, DOCX, etc.), install libreoffice:</p> <pre class="code"> <code class="code">apt-get --no-install-recommends install libreoffice</code> </pre> <a name="configuration"></a> <h3>Configuration</h3> <p>For example, to replace the native invoice report by a custom py3o report, add the following XML file in your custom module:</p> <pre class="code"> <code class="code">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;odoo&gt; &lt;record id=&quot;account.account_invoices&quot; model=&quot;ir.actions.report.xml&quot;&gt; &lt;field name=&quot;report_type&quot;&gt;py3o&lt;/field&gt; &lt;field name=&quot;py3o_filetype&quot;&gt;odt&lt;/field&gt; &lt;field name=&quot;module&quot;&gt;my_custom_module_base&lt;/field&gt; &lt;field name=&quot;py3o_template_fallback&quot;&gt;report/account_invoice.odt&lt;/field&gt; &lt;/record&gt; &lt;/odoo&gt;</code> </pre> <p>where <em>my_custom_module_base</em> is the name of the custom Odoo module. In this example, the invoice ODT file is located in <em>my_custom_module_base/report/account_invoice.odt</em>.</p> <p>It's also possible to reference a template located in a trusted path of your Odoo server. In this case you must let the <em>module</em> entry empty and specify the path to the template as <em>py3o_template_fallback</em>.</p> <pre class="code"> <code class="code">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;odoo&gt; &lt;record id=&quot;account.account_invoices&quot; model=&quot;ir.actions.report.xml&quot;&gt; &lt;field name=&quot;report_type&quot;&gt;py3o&lt;/field&gt; &lt;field name=&quot;py3o_filetype&quot;&gt;odt&lt;/field&gt; &lt;field name=&quot;py3o_template_fallback&quot;&gt;/odoo/templates/py3o/report/account_invoice.odt&lt;/field&gt; &lt;/record&gt; &lt;/odoo&gt;</code> </pre> <p>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.</p> <pre class="code"> <code class="code">[options] ... [report_py3o] root_tmpl_path=/odoo/templates/py3o</code> </pre> <p>If you want an invoice in PDF format instead of ODT format, the XML file should look like:</p> <pre class="code"> <code class="code">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;odoo&gt; &lt;record id=&quot;account.account_invoices&quot; model=&quot;ir.actions.report.xml&quot;&gt; &lt;field name=&quot;report_type&quot;&gt;py3o&lt;/field&gt; &lt;field name=&quot;py3o_filetype&quot;&gt;pdf&lt;/field&gt; &lt;field name=&quot;module&quot;&gt;my_custom_module_base&lt;/field&gt; &lt;field name=&quot;py3o_template_fallback&quot;&gt;report/account_invoice.odt&lt;/field&gt; &lt;/record&gt; &lt;/odoo&gt;</code> </pre> <p>If you want to add a new py3o PDF report (and not replace a native report), the XML file should look like this:</p> <pre class="code"> <code class="code">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;odoo&gt; &lt;record id=&quot;partner_summary_report&quot; model=&quot;ir.actions.report.xml&quot;&gt; &lt;field name=&quot;name&quot;&gt;Partner Summary&lt;/field&gt; &lt;field name=&quot;model&quot;&gt;res.partner&lt;/field&gt; &lt;field name=&quot;report_name&quot;&gt;res.partner.summary&lt;/field&gt; &lt;field name=&quot;report_type&quot;&gt;py3o&lt;/field&gt; &lt;field name=&quot;py3o_filetype&quot;&gt;pdf&lt;/field&gt; &lt;field name=&quot;module&quot;&gt;my_custom_module_base&lt;/field&gt; &lt;field name=&quot;py3o_template_fallback&quot;&gt;report/partner_summary.odt&lt;/field&gt; &lt;/record&gt; &lt;!-- Add entry in &quot;Print&quot; drop-down list --&gt; &lt;record id=&quot;button_partner_summary_report&quot; model=&quot;ir.values&quot;&gt; &lt;field name=&quot;key2&quot;&gt;client_print_multi&lt;/field&gt; &lt;field name=&quot;model&quot;&gt;res.partner&lt;/field&gt; &lt;field name=&quot;name&quot;&gt;Partner Summary&lt;/field&gt; &lt;field name=&quot;value&quot; eval=&quot;'ir.actions.report.xml,%d'%partner_summary_report&quot; /&gt; &lt;/record&gt; &lt;/odoo&gt;</code> </pre> <a name="configuration-parameters"></a> <h4>Configuration parameters</h4> <dl class="docutils"> <dt>py3o.conversion_command</dt> <dd>The command to be used to run the conversion, <code>libreoffice</code> by default. If you change this, whatever you set here must accept the parameters <code>--headless --convert-to $ext $file</code> and put the resulting file into <code>$file</code>'s directory with extension <code>$ext</code>. The command will be started in <code>$file</code>'s directory.</dd> </dl> <a name="usage"></a> <h3>Usage</h3> <a class="reference external image-reference" href="https://runbot.odoo-community.org/runbot/143/9.0"><img alt="Try me on Runbot" src="https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas" /></a> <p>The templating language is <a class="reference external" href="http://py3otemplate.readthedocs.io/en/latest/templating.html">extensively documented</a>, the records are exposed in libreoffice as <code>objects</code>, on which you can also call functions.</p> <a name="available-functions-and-objects"></a> <h4>Available functions and objects</h4> <dl class="docutils"> <dt>user</dt> <dd>Browse record of current user</dd> <dt>lang</dt> <dd>The user's company's language as string (ISO code)</dd> <dt>b64decode</dt> <dd><code>base64.b64decode</code></dd> <dt>format_multiline_value(string)</dt> <dd>Generate the ODF equivalent of <code>&lt;br/&gt;</code> and <code>&amp;nbsp;</code> for multiline fields (ODF is XML internally, so those would be skipped otherwise)</dd> <dt>html_sanitize(string)</dt> <dd>Sanitize HTML string</dd> <dt>time</dt> <dd>Python's <code>time</code> module</dd> <dt>display_address(partner)</dt> <dd>Return a formatted string of the partner's address</dd> </dl> <a name="sample-report-templates"></a> <h4>Sample report templates</h4> <p>Sample py3o report templates for the main Odoo native reports (invoice, sale order, purchase order, picking, ...) are available on the Github project <a class="reference external" href="https://github.com/akretion/odoo-py3o-report-templates">odoo-py3o-report-templates</a>.</p> <a name="known-issues-roadmap"></a> <h3>Known issues / Roadmap</h3> <ul class="simple"> <li>generate barcode ?</li> <li>add more detailed example in demo file to showcase features</li> <li>add migration guide aeroo -&gt; py3o</li> </ul> <a name="bug-tracker"></a> <h3>Bug Tracker</h3> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/reporting-engine/issues">GitHub Issues</a>. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback.</p> <a name="credits"></a> <h3>Credits</h3> <a name="contributors"></a> <h4>Contributors</h4> <ul class="simple"> <li>Florent Aide (<a class="reference external" href="http://odoo.consulting/">XCG Consulting</a>)</li> <li>Laurent Mignon &lt;<a class="reference external" href="mailto:laurent.mignon&#64;acsone.eu">laurent.mignon&#64;acsone.eu</a>&gt;,</li> <li>Alexis de Lattre &lt;<a class="reference external" href="mailto:alexis.delattre&#64;akretion.com">alexis.delattre&#64;akretion.com</a>&gt;,</li> <li>Guewen Baconnier &lt;<a class="reference external" href="mailto:guewen.baconnier&#64;camptocamp.com">guewen.baconnier&#64;camptocamp.com</a>&gt;</li> <li>Omar CastiƱeira &lt;<a class="reference external" href="mailto:omar&#64;comunitea.com">omar&#64;comunitea.com</a>&gt;</li> <li>Holger Brunn &lt;<a class="reference external" href="mailto:hbrunn&#64;therp.nl">hbrunn&#64;therp.nl</a>&gt;</li> </ul> <a name="maintainer"></a> <h4>Maintainer</h4> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>This module is maintained by the OCA.</p> <p>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.</p> <p>To contribute to this module, please visit <a class="reference external" href="https://odoo-community.org">https://odoo-community.org</a>.</p>