Metadata-Version: 2.1
Name: odoo-addon-report_qweb_signer
Version: 18.0.1.0.0.2
Requires-Python: >=3.10
Requires-Dist: odoo==18.0.*
Summary: Sign Qweb PDFs usign a PKCS#12 certificate
Home-page: https://github.com/OCA/reporting-engine
License: AGPL-3
Author: Tecnativa, Odoo Community Association (OCA)
Author-email: support@odoo-community.org
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 18.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Description-Content-Type: text/x-rst

.. image:: https://odoo-community.org/readme-banner-image
   :target: https://odoo-community.org/get-involved?utm_source=readme
   :alt: Odoo Community Association

=======================
Qweb PDF reports signer
=======================

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

.. |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/license-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/18.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-18-0/reporting-engine-18-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=18.0
    :alt: Try me on Runboat

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

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

**Table of contents**

.. contents::
   :local:

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

To install this module, you need to install pyhanko-cli, e.g.:

   pipx install pyhanko-cli

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

To start signing PDF reports you'll need first to configure your desired
certificate. To do so:

- Go to *Settings > General Settings* and then to the section
  *Certificates and Keys*. Then click on **Certificates**.
- Add the cert you want to use: upload the file and set the password.

Now you need to configure the reports using this certificate:

- Go to *Settings > Thecnical > Reporting > Reports*.
- Search for the pdf report you want to sign.
- In the report form, open the **Sign** tab.
- Choose the **Certificate** you created before.
- Optionally, you can set:

  - **Allow to sign only one document**: disallow signing a pdf that
    contains multiple docs.
  - **Save as attachment**: Set the signed document report file name
    pattern. Example:
    ``(object.name or '').replace('/','_') + '.signed.pdf'``
  - **Signing domain**: Filter the document that will be signed.
    Example:
    ``[('move_type','=','out_invoice'), ('state', '=', 'posted')]``

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".

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

- This version 18.0 depends on pyhanko-cli for signing the documents,
  which isn't ideal at all but avoids the dependency hell coming from
  cryptography requisites.
- In Odoo 19.0 Odoo implemented their own signing mechanism. We could
  backport it but it depends on python 12 which supports the proper
  cryptography library version and that would leave out any
  infrastructure using lower versions. So: for v19 we should get rid of
  all that external stuff and just use the core one. (ref:
  https://github.com/odoo/odoo/pull/194698)
- When signing multiple documents (if *Allow only one document* is
  disabled) then *Save as attachment* is not applied and signed result
  is not saved as attachment.
- Add more tests.
- This module is incompatible with the ``account_edi_ubl_cii`` module,
  because the PDF content is altered after rendering. See:
  https://github.com/odoo/odoo/blob/5977da2c93d522ece984d2fa8a31624f4b612eca/addons/account_edi_ubl_cii/models/account_move_send.py#L131C9-L140

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:%2018.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 <santi@comunitea.com>

- Omar Castiñeira <omar@comunitea.com>

- `Moduon <https://moduon.team>`__

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

     - Isaac Gallart <igallart@puntsistemes.es>

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

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/18.0/report_qweb_signer>`_ project on GitHub.

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