Skip to content

[17.0][MIG] report_qweb_signer: Migration to version 17.0 #991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4165c81
report_qweb_signer addon
antespi Nov 22, 2015
a38b07f
report_qweb_signer: Add feature request
pedrobaeza Sep 6, 2016
9b7cbd4
[MIG] report_qweb_signer: Migration to 10.0
pedrobaeza Jun 22, 2017
1f0d353
fix test_report_qweb_signer - tests were causing travis to stall
JordiBForgeFlow Sep 14, 2017
54d700e
[FIX] report_qweb_signer: Remove hardcoded memory limits
yajo Nov 17, 2017
3976bf6
[FIX] README syntax
pedrobaeza Jun 23, 2018
9b89d73
[MIG] report_qweb_designer: Migration to 12.0
chienandalu Nov 13, 2018
cc1963e
[MIG] report_qweb_signer: Refine migration
pedrobaeza May 16, 2019
ffe21f1
[FIX] report_qweb_signer: reprint report crash
chienandalu Jun 16, 2020
3cc5090
[FIX] report_qweb_signer
marcelsavegnago Oct 24, 2020
c8afa4e
[IMP] report_qweb_signer: Black python code
Jun 29, 2021
81d8fc0
[MIG] report_qweb_signer: Migration to 13.0
Jun 29, 2021
b242b2e
Apply dotfiles
sbidoul Jul 27, 2021
8a6cf3b
[IMP] report_qweb_signer add endesive
Jun 30, 2021
fa38841
[MIG] report_qweb_signer: Migration to 14.0 updating java's lib for v…
omar7r Aug 30, 2021
a91bd7a
[FIX] report_qweb_signer: noupdate defaults
chienandalu Oct 1, 2021
115440b
[IMP] report_qweb_signer: Signature visible parameter not include by …
omar7r Nov 2, 2021
e763d47
[FIX] report_qweb_signer: Fix when report is printed without related …
omar7r Nov 4, 2021
fc59a31
[FIX] report_qweb_signer: Handle multi-company correctly
omar7r Feb 18, 2022
031ffbd
[IMP] report_qweb_signer: keep env company if company is not defined
etobella Apr 19, 2022
b293fd5
[IMP] report_qweb_signer: Add default-jre-headless for GH
etobella Apr 21, 2022
4960f05
[IMP] report_qweb_signer: allowed reports on certificate
ThomasBinsfeld Aug 13, 2021
bf4c463
[ADD] report_qweb_signer: add pedrobaeza idea in ROADMAP
ThomasBinsfeld Oct 24, 2022
bd202c8
Update translation files
weblate Oct 25, 2022
6661d04
[14.0][FIX] report_qweb_signer: Fix TypeError
igallart Oct 27, 2022
a173bd3
Translated using Weblate (Italian)
mymage Mar 30, 2023
3c458ef
Translated using Weblate (Slovenian)
sysadminmatmoz Apr 11, 2023
2f79762
Update CONFIGURE.rst
sistecem Apr 28, 2023
c6597f2
Translated using Weblate (Catalan)
jabelchi Aug 8, 2023
3ac8a13
[UPD] README.rst
OCA-git-bot Sep 3, 2023
e34514e
Update translation files
weblate Oct 9, 2023
bb264ad
[IMP] pre-commit lint
HviorForgeFlow Nov 7, 2023
21d8433
Update translation files
weblate Nov 7, 2023
02366ad
[MIG] report_qweb_signer to 16.0
benwillig Jan 10, 2024
613fca9
Update translation files
weblate Apr 22, 2024
ebb962c
Translated using Weblate (Spanish)
Ivorra78 Apr 22, 2024
359dc35
Translated using Weblate (Italian)
mymage Apr 29, 2024
43c892a
[IMP] add missing _is_report_type_signable to allow signing other typ…
glitchov Sep 13, 2024
b9ae60c
[IMP] report_qweb_signer: pre-commit auto fixes
carlos-lopez-tecnativa Mar 11, 2025
5b219c9
[MIG] report_qweb_signer: Migration to version 17.0
carlos-lopez-tecnativa Mar 11, 2025
ba8ade4
[REF] report_qweb_signer: make signing functions reusable
len-foss Mar 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
185 changes: 185 additions & 0 deletions report_qweb_signer/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
=======================
Qweb PDF reports signer
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:cb6a141947d2443fb84ffb82d051635ec1add33f3249d9c48a3a65bfd961eb6e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github
:target: https://github.com/OCA/reporting-engine/tree/17.0/report_qweb_signer
:alt: OCA/reporting-engine
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/reporting-engine-17-0/reporting-engine-17-0-report_qweb_signer
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module extends the functionality of report module to sign PDFs
using a PKCS#12 certificate.

**Table of contents**

.. contents::
:local:

Installation
============

To install this module, you need to install Java JDK Headlees, e.g.:

apt-get install default-jre-headless

Configuration
=============

In order to start signing PDF documents you need to configure
certificate(s) to use in your company.

- Go to ``Settings > Companies > Companies > Your company``
- Go to ``Report configuration`` tab
- Click ``Edit``
- Add a new item in ``PDF report certificates`` list
- Click ``Create``
- Set name, certificate file, password file and model
- Optionally you can set a domain and filename pattern for saving as
attachment

For example, if you want to sign only customer invoices in posted state:

- Model: ``account.move``
- Domain:
``[('move_type','=','out_invoice'), ('state', '=', 'posted')]``
- Save as attachment:
``(object.name or '').replace('/','_') + '.signed.pdf'``

**Note**: Linux user that executes Odoo server process must have read
access to certificate file and password file

Java Memory Settings
--------------------

If you are signing large amounts of reports at the same time, or if you
have a lower worker memory size than the JVM defaults, you may need to
tune the JVM heap memory limits. Do so by adding a ``$JVM_ARGS``
environment variable that contains the required flags. Check out these
links too:

- `StackOverflow
answer <https://stackoverflow.com/a/14763095/1468388>`__.
- `Java
docs <https://docs.oracle.com/cd/E15523_01/web.1111/e13814/jvm_tuning.htm#PERFM161>`__.

Usage
=====

User just prints PDF documents (only Qweb PDF reports supported) as
usual, but signed PDF is automatically downloaded if this document model
is configured as indicated above.

If 'Save as attachment' is configured, signed PDF is saved as attachment
and next time saved one is downloaded without signing again. This is
appropiate when signing date is important, for example, when signing
customer invoices.

You can try the signing with the demo report that is included for
customers called "Test PDF certificate".

You can set extra parameters of JSignPdf library in the system parameter
named 'reportqweb_signer.java_position_parameters', for example '-V' to
visible signature into pdf. You can also set extra parameters for Java
in the system parameter named 'reportqweb_signer.java_parameters'.

Known issues / Roadmap
======================

- When signing multiple documents (if 'Allow only one document' is
disable) then 'Save as attachment' is not applied and signed result is
not saved as attachment.
- Add tests.
- Why not taking the occasion to add the whole configuration at report
level (if to be signed or not, the domain, etc...)? See
https://github.com/OCA/reporting-engine/pull/533#issuecomment-898321161

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/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 <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**>`_.

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

Credits
=======

Authors
-------

* Tecnativa

Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__:

- Rafael Blasco
- Antonio Espinosa
- Pedro M. Baeza
- Jairo Llopis
- David Vidal

- Santi Argüeso <[email protected]>

- Omar Castiñeira <[email protected]>

- `Punt Sistemes <https://www.puntsistemes.es>`__:

- Isaac Gallart <[email protected]>

Other credits
-------------

External utilities
~~~~~~~~~~~~~~~~~~

- JSignPdf: © Josef Cacek - License `MPL <http://www.mozilla.org/MPL>`__
or `LGPL2 <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>`__
- http://jsignpdf.sourceforge.net/

Icon
~~~~

`Created by Anton Noskov from the Noun
Project <https://thenounproject.com/search/?q=signed+contract&i=65694>`__

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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 <https://github.com/OCA/reporting-engine/tree/17.0/report_qweb_signer>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions report_qweb_signer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
27 changes: 27 additions & 0 deletions report_qweb_signer/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2015 Tecnativa - Antonio Espinosa
# Copyright 2017 Tecnativa - Pedro M. Baeza
# Copyright 2018 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Qweb PDF reports signer",
"summary": "Sign Qweb PDFs usign a PKCS#12 certificate",
"version": "17.0.1.0.0",
"category": "Reporting",
"website": "https://github.com/OCA/reporting-engine",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["web_editor"],
"external_dependencies": {
"python": ["endesive", "cryptography"],
"deb": ["default-jre-headless"],
},
"data": [
"data/defaults.xml",
"security/ir.model.access.csv",
"views/report_certificate_view.xml",
"views/res_company_view.xml",
],
"demo": ["demo/report_partner_demo.xml", "demo/report_certificate_demo.xml"],
}
11 changes: 11 additions & 0 deletions report_qweb_signer/data/defaults.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record model="ir.config_parameter" id="report_qweb_signer_java_param">
<field name="key">report_qweb_signer.java_parameters</field>
<field name="value">-Xms16M -Xmx16M -XX:CompressedClassSpaceSize=256m</field>
</record>
<record model="ir.config_parameter" id="report_qweb_signer_java_position_param">
<field name="key">report_qweb_signer.java_position_parameters</field>
<field name="value">-llx 400 -lly 820 -urx 600 -ury 100 -fs 8</field>
</record>
</odoo>
20 changes: 20 additions & 0 deletions report_qweb_signer/demo/report_certificate_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2015 Tecnativa - Antonio Espinosa
Copyright 2017 Tecnativa - Pedro M. Baeza
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo noupdate="1">
<record id="demo_certificate_test" model="report.certificate">
<field name="company_id" ref="base.main_company" />
<field name="name">Test OCA certificate</field>
<field name="path">test.p12</field>
<field name="password_file">test.passwd</field>
<field name="signing_method">java</field>
<field name="model_id" ref="base.model_res_partner" />
<field name="allow_only_one" eval="True" />
<field
name="attachment"
>'test_' + (object.name or '').replace(' ', '_').lower() + '.signed.pdf'</field>
</record>
</odoo>
48 changes: 48 additions & 0 deletions report_qweb_signer/demo/report_partner_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2015 Tecnativa - Antonio Espinosa
Copyright 2017 Tecnativa - Pedro M. Baeza
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<template id="report_partner_demo_document">
<t t-call="web.external_layout">
<div class="page">
<div class="row">
<div class="col-md-12">
<span
>This is a sample report for testing PDF certificates.</span>
</div>
</div>
<div class="row">
<div class="col-md-12">
<strong>Partner:</strong>
<span t-field="o.name" />
</div>
</div>
</div>
</t>
</template>
<template id="report_partner_demo">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t
t-call="report_qweb_signer.report_partner_demo_document"
t-lang="o.lang"
/>
</t>
</t>
</template>
<record id="partner_demo_report" model="ir.actions.report">
<field name="name">Test PDF certificate</field>
<field name="model">res.partner</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">report_qweb_signer.report_partner_demo</field>
<field
name="attachment"
>'test_' + (object.name or '').replace(' ', '_').lower() + '.pdf'</field>
<field name="attachment_use">True</field>
<field name="binding_model_id" ref="base.model_res_partner" />
<field name="binding_type">report</field>
</record>
</odoo>
Loading