Skip to content

Commit

Permalink
[MIG] report_qweb_encrypt: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
payen000 committed Jul 24, 2023
1 parent fd083f7 commit 7ef5792
Show file tree
Hide file tree
Showing 23 changed files with 1,030 additions and 0 deletions.
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
29 changes: 29 additions & 0 deletions report_qweb_encrypt/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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/js/report/action_manager_report.esm.js",
"report_qweb_encrypt/static/src/js/report/encrypt_dialog.xml",
],
},
"external_dependencies": {
"python": ["PyPDF2"] # Python third party libraries required for module
},
"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)

Check warning on line 16 in report_qweb_encrypt/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

report_qweb_encrypt/controllers/main.py#L16

Added line #L16 was not covered by tests
# 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]

Check warning on line 21 in report_qweb_encrypt/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

report_qweb_encrypt/controllers/main.py#L20-L21

Added lines #L20 - L21 were not covered by tests
if (
ttype in ["qweb-pdf"]
and result.headers["Content-Type"] == "application/pdf"
and "?" in url
):
data = dict(

Check warning on line 27 in report_qweb_encrypt/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

report_qweb_encrypt/controllers/main.py#L27

Added line #L27 was not covered by tests
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(

Check warning on line 31 in report_qweb_encrypt/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

report_qweb_encrypt/controllers/main.py#L31

Added line #L31 was not covered by tests
data.pop("context")
)
if "encrypt_password" in data_context:
encrypted_data = request.env["ir.actions.report"]._encrypt_pdf(

Check warning on line 35 in report_qweb_encrypt/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

report_qweb_encrypt/controllers/main.py#L35

Added line #L35 was not covered by tests
result.get_data(), data_context["encrypt_password"]
)
result.set_data(encrypted_data)
return result

Check warning on line 39 in report_qweb_encrypt/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

report_qweb_encrypt/controllers/main.py#L38-L39

Added lines #L38 - L39 were not covered by tests
81 changes: 81 additions & 0 deletions report_qweb_encrypt/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# 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"
"Last-Translator: Automatically generated\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"

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

0 comments on commit 7ef5792

Please sign in to comment.