Skip to content

Commit 28436cd

Browse files
committed
Merge PR #991 into 17.0
Signed-off-by pedrobaeza
2 parents 1995351 + ba8ade4 commit 28436cd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+20986
-0
lines changed

report_qweb_signer/README.rst

+185
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
=======================
2+
Qweb PDF reports signer
3+
=======================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:cb6a141947d2443fb84ffb82d051635ec1add33f3249d9c48a3a65bfd961eb6e
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github
20+
:target: https://github.com/OCA/reporting-engine/tree/17.0/report_qweb_signer
21+
:alt: OCA/reporting-engine
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/reporting-engine-17-0/reporting-engine-17-0-report_qweb_signer
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=17.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module extends the functionality of report module to sign PDFs
32+
using a PKCS#12 certificate.
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Installation
40+
============
41+
42+
To install this module, you need to install Java JDK Headlees, e.g.:
43+
44+
apt-get install default-jre-headless
45+
46+
Configuration
47+
=============
48+
49+
In order to start signing PDF documents you need to configure
50+
certificate(s) to use in your company.
51+
52+
- Go to ``Settings > Companies > Companies > Your company``
53+
- Go to ``Report configuration`` tab
54+
- Click ``Edit``
55+
- Add a new item in ``PDF report certificates`` list
56+
- Click ``Create``
57+
- Set name, certificate file, password file and model
58+
- Optionally you can set a domain and filename pattern for saving as
59+
attachment
60+
61+
For example, if you want to sign only customer invoices in posted state:
62+
63+
- Model: ``account.move``
64+
- Domain:
65+
``[('move_type','=','out_invoice'), ('state', '=', 'posted')]``
66+
- Save as attachment:
67+
``(object.name or '').replace('/','_') + '.signed.pdf'``
68+
69+
**Note**: Linux user that executes Odoo server process must have read
70+
access to certificate file and password file
71+
72+
Java Memory Settings
73+
--------------------
74+
75+
If you are signing large amounts of reports at the same time, or if you
76+
have a lower worker memory size than the JVM defaults, you may need to
77+
tune the JVM heap memory limits. Do so by adding a ``$JVM_ARGS``
78+
environment variable that contains the required flags. Check out these
79+
links too:
80+
81+
- `StackOverflow
82+
answer <https://stackoverflow.com/a/14763095/1468388>`__.
83+
- `Java
84+
docs <https://docs.oracle.com/cd/E15523_01/web.1111/e13814/jvm_tuning.htm#PERFM161>`__.
85+
86+
Usage
87+
=====
88+
89+
User just prints PDF documents (only Qweb PDF reports supported) as
90+
usual, but signed PDF is automatically downloaded if this document model
91+
is configured as indicated above.
92+
93+
If 'Save as attachment' is configured, signed PDF is saved as attachment
94+
and next time saved one is downloaded without signing again. This is
95+
appropiate when signing date is important, for example, when signing
96+
customer invoices.
97+
98+
You can try the signing with the demo report that is included for
99+
customers called "Test PDF certificate".
100+
101+
You can set extra parameters of JSignPdf library in the system parameter
102+
named 'reportqweb_signer.java_position_parameters', for example '-V' to
103+
visible signature into pdf. You can also set extra parameters for Java
104+
in the system parameter named 'reportqweb_signer.java_parameters'.
105+
106+
Known issues / Roadmap
107+
======================
108+
109+
- When signing multiple documents (if 'Allow only one document' is
110+
disable) then 'Save as attachment' is not applied and signed result is
111+
not saved as attachment.
112+
- Add tests.
113+
- Why not taking the occasion to add the whole configuration at report
114+
level (if to be signed or not, the domain, etc...)? See
115+
https://github.com/OCA/reporting-engine/pull/533#issuecomment-898321161
116+
117+
Bug Tracker
118+
===========
119+
120+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_.
121+
In case of trouble, please check there if your issue has already been reported.
122+
If you spotted it first, help us to smash it by providing a detailed and welcomed
123+
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_qweb_signer%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
124+
125+
Do not contact contributors directly about support or help with technical issues.
126+
127+
Credits
128+
=======
129+
130+
Authors
131+
-------
132+
133+
* Tecnativa
134+
135+
Contributors
136+
------------
137+
138+
- `Tecnativa <https://www.tecnativa.com>`__:
139+
140+
- Rafael Blasco
141+
- Antonio Espinosa
142+
- Pedro M. Baeza
143+
- Jairo Llopis
144+
- David Vidal
145+
146+
- Santi Argüeso <santi@comunitea.com>
147+
148+
- Omar Castiñeira <omar@comunitea.com>
149+
150+
- `Punt Sistemes <https://www.puntsistemes.es>`__:
151+
152+
- Isaac Gallart <igallart@puntsistemes.es>
153+
154+
Other credits
155+
-------------
156+
157+
External utilities
158+
~~~~~~~~~~~~~~~~~~
159+
160+
- JSignPdf: © Josef Cacek - License `MPL <http://www.mozilla.org/MPL>`__
161+
or `LGPL2 <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>`__
162+
- http://jsignpdf.sourceforge.net/
163+
164+
Icon
165+
~~~~
166+
167+
`Created by Anton Noskov from the Noun
168+
Project <https://thenounproject.com/search/?q=signed+contract&i=65694>`__
169+
170+
Maintainers
171+
-----------
172+
173+
This module is maintained by the OCA.
174+
175+
.. image:: https://odoo-community.org/logo.png
176+
:alt: Odoo Community Association
177+
:target: https://odoo-community.org
178+
179+
OCA, or the Odoo Community Association, is a nonprofit organization whose
180+
mission is to support the collaborative development of Odoo features and
181+
promote its widespread use.
182+
183+
This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/17.0/report_qweb_signer>`_ project on GitHub.
184+
185+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

report_qweb_signer/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
2+
3+
from . import models

report_qweb_signer/__manifest__.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2015 Tecnativa - Antonio Espinosa
2+
# Copyright 2017 Tecnativa - Pedro M. Baeza
3+
# Copyright 2018 Tecnativa - David Vidal
4+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
5+
6+
{
7+
"name": "Qweb PDF reports signer",
8+
"summary": "Sign Qweb PDFs usign a PKCS#12 certificate",
9+
"version": "17.0.1.0.0",
10+
"category": "Reporting",
11+
"website": "https://github.com/OCA/reporting-engine",
12+
"author": "Tecnativa, " "Odoo Community Association (OCA)",
13+
"license": "AGPL-3",
14+
"installable": True,
15+
"depends": ["web_editor"],
16+
"external_dependencies": {
17+
"python": ["endesive", "cryptography"],
18+
"deb": ["default-jre-headless"],
19+
},
20+
"data": [
21+
"data/defaults.xml",
22+
"security/ir.model.access.csv",
23+
"views/report_certificate_view.xml",
24+
"views/res_company_view.xml",
25+
],
26+
"demo": ["demo/report_partner_demo.xml", "demo/report_certificate_demo.xml"],
27+
}

report_qweb_signer/data/defaults.xml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo noupdate="1">
3+
<record model="ir.config_parameter" id="report_qweb_signer_java_param">
4+
<field name="key">report_qweb_signer.java_parameters</field>
5+
<field name="value">-Xms16M -Xmx16M -XX:CompressedClassSpaceSize=256m</field>
6+
</record>
7+
<record model="ir.config_parameter" id="report_qweb_signer_java_position_param">
8+
<field name="key">report_qweb_signer.java_position_parameters</field>
9+
<field name="value">-llx 400 -lly 820 -urx 600 -ury 100 -fs 8</field>
10+
</record>
11+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!--
3+
Copyright 2015 Tecnativa - Antonio Espinosa
4+
Copyright 2017 Tecnativa - Pedro M. Baeza
5+
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
6+
-->
7+
<odoo noupdate="1">
8+
<record id="demo_certificate_test" model="report.certificate">
9+
<field name="company_id" ref="base.main_company" />
10+
<field name="name">Test OCA certificate</field>
11+
<field name="path">test.p12</field>
12+
<field name="password_file">test.passwd</field>
13+
<field name="signing_method">java</field>
14+
<field name="model_id" ref="base.model_res_partner" />
15+
<field name="allow_only_one" eval="True" />
16+
<field
17+
name="attachment"
18+
>'test_' + (object.name or '').replace(' ', '_').lower() + '.signed.pdf'</field>
19+
</record>
20+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!--
3+
Copyright 2015 Tecnativa - Antonio Espinosa
4+
Copyright 2017 Tecnativa - Pedro M. Baeza
5+
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
6+
-->
7+
<odoo>
8+
<template id="report_partner_demo_document">
9+
<t t-call="web.external_layout">
10+
<div class="page">
11+
<div class="row">
12+
<div class="col-md-12">
13+
<span
14+
>This is a sample report for testing PDF certificates.</span>
15+
</div>
16+
</div>
17+
<div class="row">
18+
<div class="col-md-12">
19+
<strong>Partner:</strong>
20+
<span t-field="o.name" />
21+
</div>
22+
</div>
23+
</div>
24+
</t>
25+
</template>
26+
<template id="report_partner_demo">
27+
<t t-call="web.html_container">
28+
<t t-foreach="docs" t-as="o">
29+
<t
30+
t-call="report_qweb_signer.report_partner_demo_document"
31+
t-lang="o.lang"
32+
/>
33+
</t>
34+
</t>
35+
</template>
36+
<record id="partner_demo_report" model="ir.actions.report">
37+
<field name="name">Test PDF certificate</field>
38+
<field name="model">res.partner</field>
39+
<field name="report_type">qweb-pdf</field>
40+
<field name="report_name">report_qweb_signer.report_partner_demo</field>
41+
<field
42+
name="attachment"
43+
>'test_' + (object.name or '').replace(' ', '_').lower() + '.pdf'</field>
44+
<field name="attachment_use">True</field>
45+
<field name="binding_model_id" ref="base.model_res_partner" />
46+
<field name="binding_type">report</field>
47+
</record>
48+
</odoo>

0 commit comments

Comments
 (0)