-
-
Notifications
You must be signed in to change notification settings - Fork 918
[MIG] report_qweb_signer: Migration to 12.0 #253
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
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
df96442
report_qweb_signer addon
antespi 55a244d
report_qweb_signer: Add feature request
pedrobaeza 9359415
OCA Transbot updated translations from Transifex
oca-transbot 97f9aba
[MIG] report_qweb_signer: Migration to 10.0
pedrobaeza 7b31883
OCA Transbot updated translations from Transifex
oca-transbot 8db0c51
fix test_report_qweb_signer - tests were causing travis to stall
JordiBForgeFlow 10276de
[FIX] report_qweb_signer: Remove hardcoded memory limits
yajo e614522
OCA Transbot updated translations from Transifex
oca-transbot 7c4219e
[UPD] Update report_qweb_signer.pot
oca-travis 523a270
[FIX] README syntax
pedrobaeza c65a394
[MIG] report_qweb_designer: Migration to 12.0
chienandalu ef5a6bf
.travis.yml: Adapt to latest standard + add variable for JavaVM error
pedrobaeza 6e462b2
[MIG] report_qweb_signer: Refine migration
pedrobaeza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| ======================= | ||
| Qweb PDF reports signer | ||
| ======================= | ||
|
|
||
| .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! This file is generated by oca-gen-addon-readme !! | ||
| !! changes will be overwritten. !! | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
|
||
| .. |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/12.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-12-0/reporting-engine-12-0-report_qweb_signer | ||
| :alt: Translate me on Weblate | ||
| .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
| :target: https://runbot.odoo-community.org/runbot/143/12.0 | ||
| :alt: Try me on Runbot | ||
|
|
||
| |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 openjdk-8-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 open or paid state: | ||
|
|
||
| * Model: ``account.invoice`` | ||
| * Domain: ``[('type','=','out_invoice'), ('state', 'in', ('open', 'paid'))]`` | ||
| * Save as attachment: ``(object.number 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". | ||
|
|
||
| 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. | ||
| * To have a visible signature through an image embedded in the resulting PDF. | ||
| * Add tests. | ||
|
|
||
| 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 smashing it by providing a detailed and welcomed | ||
| `feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_qweb_signer%0Aversion:%2012.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 | ||
|
|
||
| Other credits | ||
| ~~~~~~~~~~~~~ | ||
|
|
||
| External utilities | ||
| ++++++++++++++++++ | ||
|
|
||
| * iText v1.4.8: © 2000-2006, Paulo Soares, Bruno Lowagie and others - License `MPL <http://www.mozilla.org/MPL>`__ or `LGPL2 <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>`__ - http://sourceforge.net/projects/itext | ||
| * jPdfSign: © 2006 Jan Peter Stotz - License `MPL <http://www.mozilla.org/MPL>`__ or `LGPL2 <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>`__ (inherited from iText) - http://private.sit.fraunhofer.de/~stotz/software/jpdfsign | ||
| * Modified jPdfSign: © 2015 Antonio Espinosa - License `MPL <http://www.mozilla.org/MPL>`__ or `LGPL2 <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>`__ (inherited from iText) - static/src/java/JPdfSign.java | ||
|
|
||
| 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/12.0/report_qweb_signer>`_ project on GitHub. | ||
|
|
||
| You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # 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": "12.0.1.0.0", | ||
| "category": "Reporting", | ||
| "website": "https://www.github.com/reporting-engine", | ||
| "author": "Tecnativa, " | ||
| "Odoo Community Association (OCA)", | ||
| "license": "AGPL-3", | ||
| "installable": True, | ||
| "depends": [ | ||
| "web_editor", | ||
| ], | ||
| "external_dependencies": { | ||
| "bin": ['/usr/bin/java'], | ||
| }, | ||
| "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", | ||
| ], | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <odoo> | ||
| <record model="ir.config_parameter" id="report_qweb_signer_java_param"> | ||
| <field name="key">report_qweb_signer.java_parameters</field> | ||
| <field name="value">-Xms4M -Xmx4M</field> | ||
| </record> | ||
| </odoo> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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="model_id" ref="base.model_res_partner"/> | ||
| <field name="domain">[('customer', '=', True)]</field> | ||
| <field name="allow_only_one" eval="True"/> | ||
| <field name="attachment">'test_' + (object.name or '').replace(' ', '_').lower() + '.signed.pdf'</field> | ||
| </record> | ||
|
|
||
| </odoo> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| <?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> | ||
|
|
||
| <report | ||
| id="partner_demo_report" | ||
| model="res.partner" | ||
| string="Test PDF certificate" | ||
| report_type="qweb-pdf" | ||
| name="report_qweb_signer.report_partner_demo" | ||
| file="report_qweb_signer.report_partner_demo" | ||
| attachment_use="True" | ||
| attachment="'test_' + (object.name or '').replace(' ', '_').lower() + '.pdf'" | ||
| /> | ||
|
|
||
| </odoo> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.