Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
92 changes: 92 additions & 0 deletions report_qweb_encrypt/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
===================
Report Qweb Encrypt
===================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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/15.0/report_qweb_encrypt
: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-15-0/reporting-engine-15-0-report_qweb_encrypt
: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/15.0
:alt: Try me on Runbot

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

This module allow you to encrypt PDF with a password seting option,

* Manually keyin password (only applicable for record print action)
* Auto generated password based on object data (python)

**Table of contents**

.. contents::
:local:

Usage
=====

To make a report encryptable mark the field `Encryption` in the report record.

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_encrypt%0Aversion:%2015.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
~~~~~~~

* Creu Blanca
* Ecosoft

Contributors
~~~~~~~~~~~~

* Enric Tobella <etobella@creublanca.es>
* Jaime Arroyo <jaime.arroyo@creublanca.es>
* Kitti U. <kittiu@ecosoft.co.th>

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.

.. |maintainer-kittiu| image:: https://github.com/kittiu.png?size=40px
:target: https://github.com/kittiu
:alt: kittiu

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-kittiu|

This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/15.0/report_qweb_encrypt>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions report_qweb_encrypt/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
26 changes: 26 additions & 0 deletions report_qweb_encrypt/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2020 Creu Blanca
# Copyright 2020 Ecosoft Co., Ltd.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Report Qweb Encrypt",
"summary": "Allow to encrypt qweb pdfs",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Creu Blanca,Ecosoft,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/reporting-engine",
"depends": [
"web",
],
"data": [
"views/ir_actions_report.xml",
],
"assets": {
"web.assets_backend": [
"report_qweb_encrypt/static/src/report/action_manager_report.esm.js",
"report_qweb_encrypt/static/src/report/encrypt_dialog.xml",
],
},
"installable": True,
"maintainers": ["kittiu"],
}
1 change: 1 addition & 0 deletions report_qweb_encrypt/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
39 changes: 39 additions & 0 deletions report_qweb_encrypt/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2020 Creu Blanca
# Copyright 2020 Ecosoft Co., Ltd.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import json

from werkzeug.urls import url_decode

from odoo.http import request, route

from odoo.addons.web.controllers.report import ReportController


class ReportControllerEncrypt(ReportController):
@route()
def report_download(self, data, context=None):
result = super().report_download(data, context=context)
# When report is downloaded from print action, this function is called,
# but this function cannot pass context (manually entered password) to
# report.render_qweb_pdf(), encrypton for manual password is done here.
requestcontent = json.loads(data)
url, ttype = requestcontent[0], requestcontent[1]
if (
ttype in ["qweb-pdf"]
and result.headers["Content-Type"] == "application/pdf"
and "?" in url
):
data = dict(
url_decode(url.split("?")[1]).items()
) # decoding the args represented in JSON
if "context" in data:
context, data_context = json.loads(context or "{}"), json.loads(
data.pop("context")
)
if "encrypt_password" in data_context:
encrypted_data = request.env["ir.actions.report"]._encrypt_pdf(
result.get_data(), data_context["encrypt_password"]
)
result.set_data(encrypted_data)
return result
91 changes: 91 additions & 0 deletions report_qweb_encrypt/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * report_qweb_encrypt
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-07-13 20:08+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: report_qweb_encrypt
#: model:ir.model.fields,help:report_qweb_encrypt.field_ir_actions_report__encrypt
msgid ""
"* Manual Input Password: allow user to key in password on the fly. This "
"option available only on document print action.\n"
"* Auto Generated Password: system will auto encrypt password when PDF "
"created, based on provided python syntax."
msgstr ""
"* Contraseña de entrada manual: permite al usuario introducir la contraseña "
"sobre la marcha. Esta opción sólo está disponible en la acción de impresión "
"de documentos.\n"
"* Contraseña generada automáticamente: el sistema cifrará automáticamente la "
"contraseña cuando se cree el PDF, basándose en la sintaxis python "
"proporcionada."

#. module: report_qweb_encrypt
#: model:ir.model.fields.selection,name:report_qweb_encrypt.selection__ir_actions_report__encrypt__auto
msgid "Auto Generated Password"
msgstr "Contraseña generada automáticamente"

#. module: report_qweb_encrypt
#. openerp-web
#: code:addons/report_qweb_encrypt/static/src/js/report/encrypt_dialog.xml:0
#, python-format
msgid "Cancel"
msgstr "Cancelar"

#. module: report_qweb_encrypt
#: model:ir.model.fields,field_description:report_qweb_encrypt.field_ir_actions_report__encrypt_password
msgid "Encrypt Password"
msgstr "Encriptar contraseña"

#. module: report_qweb_encrypt
#: model:ir.model.fields,field_description:report_qweb_encrypt.field_ir_actions_report__encrypt
msgid "Encryption"
msgstr "Encriptación"

#. module: report_qweb_encrypt
#: model:ir.model.fields.selection,name:report_qweb_encrypt.selection__ir_actions_report__encrypt__manual
msgid "Manual Input Password"
msgstr "Contraseña de entrada manual"

#. module: report_qweb_encrypt
#. openerp-web
#: code:addons/report_qweb_encrypt/static/src/js/report/encrypt_dialog.xml:0
#, python-format
msgid "Ok"
msgstr "Aceptar"

#. module: report_qweb_encrypt
#: model:ir.model.fields,help:report_qweb_encrypt.field_ir_actions_report__encrypt_password
msgid "Python code syntax to gnerate password."
msgstr "Sintaxis del código Python para generar la contraseña."

#. module: report_qweb_encrypt
#: code:addons/report_qweb_encrypt/models/ir_actions_report.py:0
#, python-format
msgid ""
"Python code used for encryption password is invalid.\n"
"%s"
msgstr ""
"El código Python utilizado para cifrar la contraseña no es válido.\n"
"%s"

#. module: report_qweb_encrypt
#: model:ir.model,name:report_qweb_encrypt.model_ir_actions_report
msgid "Report Action"
msgstr "Informar Acción"

#. module: report_qweb_encrypt
#: model_terms:ir.ui.view,arch_db:report_qweb_encrypt.ir_actions_report_form_view
msgid "python syntax, i.e., (object.default_code or 'secretcode')"
msgstr "sintaxis python, es decir, (object.default_code o 'secretcode')"
78 changes: 78 additions & 0 deletions report_qweb_encrypt/i18n/report_qweb_encrypt.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * report_qweb_encrypt
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: report_qweb_encrypt
#: model:ir.model.fields,help:report_qweb_encrypt.field_ir_actions_report__encrypt
msgid ""
"* Manual Input Password: allow user to key in password on the fly. This option available only on document print action.\n"
"* Auto Generated Password: system will auto encrypt password when PDF created, based on provided python syntax."
msgstr ""

#. module: report_qweb_encrypt
#: model:ir.model.fields.selection,name:report_qweb_encrypt.selection__ir_actions_report__encrypt__auto
msgid "Auto Generated Password"
msgstr ""

#. module: report_qweb_encrypt
#. openerp-web
#: code:addons/report_qweb_encrypt/static/src/js/report/encrypt_dialog.xml:0
#, python-format
msgid "Cancel"
msgstr ""

#. module: report_qweb_encrypt
#: model:ir.model.fields,field_description:report_qweb_encrypt.field_ir_actions_report__encrypt_password
msgid "Encrypt Password"
msgstr ""

#. module: report_qweb_encrypt
#: model:ir.model.fields,field_description:report_qweb_encrypt.field_ir_actions_report__encrypt
msgid "Encryption"
msgstr ""

#. module: report_qweb_encrypt
#: model:ir.model.fields.selection,name:report_qweb_encrypt.selection__ir_actions_report__encrypt__manual
msgid "Manual Input Password"
msgstr ""

#. module: report_qweb_encrypt
#. openerp-web
#: code:addons/report_qweb_encrypt/static/src/js/report/encrypt_dialog.xml:0
#, python-format
msgid "Ok"
msgstr ""

#. module: report_qweb_encrypt
#: model:ir.model.fields,help:report_qweb_encrypt.field_ir_actions_report__encrypt_password
msgid "Python code syntax to gnerate password."
msgstr ""

#. module: report_qweb_encrypt
#: code:addons/report_qweb_encrypt/models/ir_actions_report.py:0
#, python-format
msgid ""
"Python code used for encryption password is invalid.\n"
"%s"
msgstr ""

#. module: report_qweb_encrypt
#: model:ir.model,name:report_qweb_encrypt.model_ir_actions_report
msgid "Report Action"
msgstr ""

#. module: report_qweb_encrypt
#: model_terms:ir.ui.view,arch_db:report_qweb_encrypt.ir_actions_report_form_view
msgid "python syntax, i.e., (object.default_code or 'secretcode')"
msgstr ""
1 change: 1 addition & 0 deletions report_qweb_encrypt/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import ir_actions_report
Loading