Browse Source

Update and improve README instructions to setup py3o

pull/258/head
Alexis de Lattre 8 years ago
committed by Laurent Mignon (ACSONE)
parent
commit
f1ee7c0a35
  1. 71
      report_py3o/README.rst

71
report_py3o/README.rst

@ -65,17 +65,23 @@ Installation of Libreoffice and JRE on Debian/Ubuntu:
sudo apt-get install default-jre ure libreoffice-java-common libreoffice-writer
You may have to install additionnal fonts. For example, to have the special unicode symbols for phone/fax/email in the PDF reports generated by Py3o, you should install the following package:
.. code::
sudo apt-get install fonts-symbola
At the end, with the dependencies, you should have the following py3o python libs:
.. code::
% pip freeze | grep py3o
py3o.formats==0.3
py3o.fusion==0.8.6.dev1
py3o.fusion==0.8.6
py3o.renderclient==0.2
py3o.renderers.juno==0.7
py3o.renderserver==0.5.1.dev1
py3o.template==0.9.10.dev1
py3o.renderers.juno==0.8
py3o.renderserver==0.5.1
py3o.template==0.9.11
py3o.types==0.1.1
Start the Py3o Fusion server:
@ -88,29 +94,15 @@ Start the Py3o render server:
.. code::
start-py3o-renderserver --java=/usr/lib/jvm/default-java/jre/lib/amd64/server/libjvm.so --ure=/usr/lib --office=/usr/lib/libreoffice --driver=juno --sofficeport=8997
start-py3o-renderserver --java=/usr/lib/jvm/default-java/jre/lib/amd64/server/libjvm.so --ure=/usr/share --office=/usr/lib/libreoffice --driver=juno --sofficeport=8997
On the output of the Py3o render server, the first line looks like:
.. code::
DEBUG:root:Starting JVM: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so with options: -Djava.class.path=/usr/local/lib/python2.7/dist-packages/py3o/renderers/juno/py3oconverter.jar:/usr/lib/ure/share/java/juh.jar:/usr/lib/ure/share/java/jurt.jar:/usr/lib/ure/share/java/ridl.jar:/usr/lib/ure/share/java/unoloader.jar:/usr/lib/ure/share/java/java_uno.jar:/usr/lib/libreoffice/program/classes/unoil.jar -Xmx150M
DEBUG:root:Starting JVM: /usr/lib/jvm/default-java/jre/lib/amd64/server/libjvm.so with options: -Djava.class.path=/usr/local/lib/python2.7/dist-packages/py3o/renderers/juno/py3oconverter.jar:/usr/share/java/juh.jar:/usr/share/java/jurt.jar:/usr/share/java/ridl.jar:/usr/share/java/unoloader.jar:/usr/share/java/java_uno.jar:/usr/lib/libreoffice/program/classes/unoil.jar -Xmx150M
After **-Djava.class.path**, there is a list of Java libs with *.jar* extension ; check that each JAR file is really present on your filesystem. On Ubuntu 16.04 LTS, the package *ure* installs several libs in another directory:
* /usr/lib/ure/share/java/juh.jar is located in /usr/share/java/juh.jar
* /usr/lib/ure/share/java/jurt.jar is located in /usr/share/java/jurt.jar
* /usr/lib/ure/share/java/ridl.jar is located in /usr/share/java/ridl.jar
* /usr/lib/ure/share/java/unoloader.jar is located in /usr/share/java/unoloader.jar
* /usr/lib/ure/share/java/java_uno.jar is located in /usr/share/java/java_uno.jar
To work around this problem, you can create a symlink:
.. code::
sudo ln -s /usr /ure
and then use **--ure=/** instead of **--ure=/usr/lib** in the command line of *start-py3o-renderserver*.
After **-Djava.class.path**, there is a list of Java libs with *.jar* extension ; check that each JAR file is really present on your filesystem. If one of the jar files is present in another directory, create a symlink that points to the real location of the file. If all the jar files are present on another directory, adapt the *--ure=* argument on the command line of Py3o render server.
To check that the Py3o Fusion server is running fine, visit the URL http://<IP_address>:8765/form. On this web page, under the section *Target format*, make sure that you have a line *This server currently supports these formats: ods, odt, docx, doc, html, docbook, pdf, xls.*.
@ -125,9 +117,6 @@ For example, to replace the native invoice report by a custom py3o report, add t
<odoo>
<record id="account.account_invoices" model="ir.actions.report.xml">
<field name="name">Invoice</field>
<field name="model">account.invoice</field>
<field name="report_name">account.report_invoice</field>
<field name="report_type">py3o</field>
<field name="py3o_filetype">odt</field>
<field name="module">my_custom_module_base</field>
@ -150,9 +139,6 @@ If you want an invoice in PDF format instead of ODT format, the XML file should
</record>
<record id="account.account_invoices" model="ir.actions.report.xml">
<field name="name">Invoice</field>
<field name="model">account.invoice</field>
<field name="report_name">account.report_invoice</field>
<field name="report_type">py3o</field>
<field name="py3o_filetype">pdf</field>
<field name="py3o_server_id" ref="local_py3o_server"/>
@ -162,6 +148,37 @@ If you want an invoice in PDF format instead of ODT format, the XML file should
</odoo>
If you want to add a new py3o PDF report (and not replace a native report), the XML file should look like this:
.. code::
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="local_py3o_server" model="py3o.server">
<field name="url">http://localhost:8765/form</field>
</record>
<record id="partner_summary_report" model="ir.actions.report.xml">
<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="py3o_server_id" ref="local_py3o_server"/>
<field name="module">my_custom_module_base</field>
<field name="py3o_template_fallback">report/partner_summary.odt</field>
</record>
<!-- Add entry in "Print" drop-down list -->
<record id="button_partner_summary_report" model="ir.values">
<field name="key2">client_print_multi</field>
<field name="model">res.partner</field>
<field name="name">Partner Summary</field>
<field name="value" eval="'ir.actions.report.xml,%d'%partner_summary_report" />
</record>
</odoo>
Usage
=====

Loading…
Cancel
Save