Browse Source

[MIG] report_qweb_pdf_watermark: Migration to 11.0

myc-14.0-py3o
Rod Schouteden 6 years ago
committed by fshah
parent
commit
8d88afaede
  1. 5
      report_qweb_pdf_watermark/README.rst
  2. 2
      report_qweb_pdf_watermark/__init__.py
  3. 17
      report_qweb_pdf_watermark/__manifest__.py
  4. 8
      report_qweb_pdf_watermark/demo/report.xml
  5. 8
      report_qweb_pdf_watermark/i18n/ca.po
  6. 8
      report_qweb_pdf_watermark/i18n/da.po
  7. 13
      report_qweb_pdf_watermark/i18n/de.po
  8. 11
      report_qweb_pdf_watermark/i18n/el_GR.po
  9. 13
      report_qweb_pdf_watermark/i18n/es.po
  10. 11
      report_qweb_pdf_watermark/i18n/es_CO.po
  11. 10
      report_qweb_pdf_watermark/i18n/fr.po
  12. 8
      report_qweb_pdf_watermark/i18n/gl.po
  13. 34
      report_qweb_pdf_watermark/i18n/hr.po
  14. 16
      report_qweb_pdf_watermark/i18n/hr_HR.po
  15. 10
      report_qweb_pdf_watermark/i18n/it.po
  16. 11
      report_qweb_pdf_watermark/i18n/nb_NO.po
  17. 13
      report_qweb_pdf_watermark/i18n/nl_NL.po
  18. 11
      report_qweb_pdf_watermark/i18n/pl.po
  19. 8
      report_qweb_pdf_watermark/i18n/pt.po
  20. 11
      report_qweb_pdf_watermark/i18n/pt_BR.po
  21. 13
      report_qweb_pdf_watermark/i18n/pt_PT.po
  22. 11
      report_qweb_pdf_watermark/i18n/sl.po
  23. 10
      report_qweb_pdf_watermark/i18n/tr.po
  24. 11
      report_qweb_pdf_watermark/i18n/tr_TR.po
  25. 2
      report_qweb_pdf_watermark/models/__init__.py
  26. 14
      report_qweb_pdf_watermark/models/ir_actions_report_xml.py
  27. 69
      report_qweb_pdf_watermark/models/report.py
  28. 1
      report_qweb_pdf_watermark/tests/__init__.py
  29. 11
      report_qweb_pdf_watermark/tests/test_report_qweb_pdf_watermark.py
  30. 2
      report_qweb_pdf_watermark/views/ir_actions_report_xml.xml
  31. 2
      report_qweb_pdf_watermark/views/layout_templates.xml

5
report_qweb_pdf_watermark/README.rst

@ -11,7 +11,9 @@ This module was written to add watermarks (backgrounds) to PDF reports. Because
Installation
============
This module works out of the box, but is faster if you install the python library PyPDF2.
As PyPDF is not supported in python3, you need to install PyPDF2::
$ pip install pypdf2
Usage
=====
@ -51,6 +53,7 @@ Contributors
* Holger Brunn <hbrunn@therp.nl>
* Stefan Rijnhart <stefan@opener.am>
* Rod Schouteden <rod.schouteden@dynapps.be>
Do not contact contributors directly about help with questions or problems concerning this addon, but use the `community mailing list <mailto:community@mail.odoo.com>`_ or the `appropriate specialized mailinglist <https://odoo-community.org/groups>`_ for help, and the bug tracker linked in `Bug Tracker`_ above for technical issues.

2
report_qweb_pdf_watermark/__init__.py

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models

17
report_qweb_pdf_watermark/__manifest__.py

@ -1,20 +1,29 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Pdf watermark",
"version": "10.0.1.0.2",
"version": "11.0.1.0.0",
"author": "Therp BV, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Reporting",
"category": "Technical Settings",
"summary": "Add watermarks to your QWEB PDF reports",
"website": "https://github.com/oca/reporting-engine",
"depends": [
'report',
'web',
],
"data": [
"demo/report.xml",
"views/ir_actions_report_xml.xml",
"views/layout_templates.xml",
],
"demo": [
"demo/report.xml"
],
"intallable": True,
'external_dependencies': {
'python': [
'PyPDF2',
],
},
}

8
report_qweb_pdf_watermark/demo/report.xml

@ -7,14 +7,14 @@
report_type="qweb-pdf"
name="report_qweb_pdf_watermark.demo_report_view"
file="report_qweb_pdf_watermark.demo_report_view"
paperformat="report.paperformat_euro"
paperformat="base.paperformat_euro"
/>
<record id="demo_report" model="ir.actions.report.xml">
<record id="demo_report" model="ir.actions.report">
<field name="pdf_watermark_expression">docs[:1].company_id.logo</field>
</record>
<template id="demo_report_view">
<t t-call="report.html_container">
<t t-call="report.external_layout">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<ul>
<li t-foreach="docs" t-as="doc">

8
report_qweb_pdf_watermark/i18n/ca.po

@ -12,10 +12,10 @@ msgstr ""
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: Carles Antoli <carlesantoli@hotmail.com>, 2017\n"
"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: ca\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: report_qweb_pdf_watermark
@ -26,7 +26,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -46,6 +46,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr ""

8
report_qweb_pdf_watermark/i18n/da.po

@ -12,10 +12,10 @@ msgstr ""
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: Hans Henrik Gabelgaard <hhg@gabelgaard.org>, 2017\n"
"Language-Team: Danish (https://www.transifex.com/oca/teams/23907/da/)\n"
"Language: da\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: da\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: report_qweb_pdf_watermark
@ -26,7 +26,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -46,6 +46,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr ""

13
report_qweb_pdf_watermark/i18n/de.po

@ -13,10 +13,10 @@ msgstr ""
"PO-Revision-Date: 2017-03-04 05:58+0000\n"
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>, 2017\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: report_qweb_pdf_watermark
@ -25,12 +25,11 @@ msgid ""
"An expression yielding the base64 encoded data to be used as watermark. \n"
"You have access to variables `env` and `docs`"
msgstr ""
"Ein Ausdruck der base64-geschlüsselte Daten, zur Verwendung als "
"Wasserzeichen, liefert.\n"
"Ein Ausdruck der base64-geschlüsselte Daten, zur Verwendung als Wasserzeichen, liefert.\n"
"Sie haben die Variablen 'env' und 'docs' zur Verfügung"
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr "Beispielbericht"
@ -50,6 +49,6 @@ msgid "Watermark expression"
msgstr "Wasserzeichnen-Ausdruck"
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
msgstr "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr "ir.actions.report"

11
report_qweb_pdf_watermark/i18n/el_GR.po

@ -11,12 +11,11 @@ msgstr ""
"POT-Creation-Date: 2017-01-10 03:40+0000\n"
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: Kostas Goutoudis <goutoudis@gmail.com>, 2017\n"
"Language-Team: Greek (Greece) (https://www.transifex.com/oca/teams/23907/"
"el_GR/)\n"
"Language: el_GR\n"
"Language-Team: Greek (Greece) (https://www.transifex.com/oca/teams/23907/el_GR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: el_GR\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: report_qweb_pdf_watermark
@ -27,7 +26,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -47,6 +46,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr ""

13
report_qweb_pdf_watermark/i18n/es.po

@ -13,10 +13,10 @@ msgstr ""
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: report_qweb_pdf_watermark
@ -25,12 +25,11 @@ msgid ""
"An expression yielding the base64 encoded data to be used as watermark. \n"
"You have access to variables `env` and `docs`"
msgstr ""
"Una expresión que obtenga los datos codificados en base64 a ser usada como "
"marca de agua.\n"
"Una expresión que obtenga los datos codificados en base64 a ser usada como marca de agua.\n"
"Tiene acceso a las variables `env` y `docs`."
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr "Informe demo"
@ -50,6 +49,6 @@ msgid "Watermark expression"
msgstr "Expresión para la marca de agua"
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
msgstr "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr "ir.actions.report"

11
report_qweb_pdf_watermark/i18n/es_CO.po

@ -11,12 +11,11 @@ msgstr ""
"POT-Creation-Date: 2017-01-10 03:40+0000\n"
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: John Toro <johntoro@gmail.com>, 2017\n"
"Language-Team: Spanish (Colombia) (https://www.transifex.com/oca/teams/23907/"
"es_CO/)\n"
"Language: es_CO\n"
"Language-Team: Spanish (Colombia) (https://www.transifex.com/oca/teams/23907/es_CO/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es_CO\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: report_qweb_pdf_watermark
@ -27,7 +26,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -47,6 +46,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr ""

10
report_qweb_pdf_watermark/i18n/fr.po

@ -13,10 +13,10 @@ msgstr ""
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: report_qweb_pdf_watermark
@ -27,7 +27,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -47,6 +47,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
msgstr "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr "ir.actions.report"

8
report_qweb_pdf_watermark/i18n/gl.po

@ -12,10 +12,10 @@ msgstr ""
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: Alejandro Santana <alejandrosantana@anubia.es>, 2017\n"
"Language-Team: Galician (https://www.transifex.com/oca/teams/23907/gl/)\n"
"Language: gl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: gl\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: report_qweb_pdf_watermark
@ -26,7 +26,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -46,6 +46,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr ""

34
report_qweb_pdf_watermark/i18n/hr.po

@ -3,22 +3,20 @@
# * report_qweb_pdf_watermark
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# Bole <bole@dajmi5.com>, 2018
# Bole <bole@dajmi5.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-16 01:44+0000\n"
"PO-Revision-Date: 2018-02-16 01:44+0000\n"
"Last-Translator: Bole <bole@dajmi5.com>, 2018\n"
"POT-Creation-Date: 2017-01-10 03:40+0000\n"
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: Bole <bole@dajmi5.com>, 2017\n"
"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n"
"Language: hr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"Language: hr\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
#. module: report_qweb_pdf_watermark
#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression
@ -26,30 +24,28 @@ msgid ""
"An expression yielding the base64 encoded data to be used as watermark. \n"
"You have access to variables `env` and `docs`"
msgstr ""
"Izraz koji polučuje base46 kodirane podatke koji se koriste kao vodeni žig.\n"
"Imate pristup varijablama 'env' i 'docs'"
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr "Demo izvještaj"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_report
msgid "Report"
msgstr "Izvještaj"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model.fields,field_description:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark
msgid "Watermark"
msgstr "Vodeni žig"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model.fields,field_description:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression
msgid "Watermark expression"
msgstr "Izraz vodenog žiga"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
msgstr "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr "ir.actions.report"

16
report_qweb_pdf_watermark/i18n/hr_HR.po

@ -11,14 +11,12 @@ msgstr ""
"POT-Creation-Date: 2017-07-13 02:42+0000\n"
"PO-Revision-Date: 2017-07-13 02:42+0000\n"
"Last-Translator: Bole <bole@dajmi5.com>, 2017\n"
"Language-Team: Croatian (Croatia) (https://www.transifex.com/oca/teams/23907/"
"hr_HR/)\n"
"Language: hr_HR\n"
"Language-Team: Croatian (Croatia) (https://www.transifex.com/oca/teams/23907/hr_HR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"Language: hr_HR\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
#. module: report_qweb_pdf_watermark
#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression
@ -30,7 +28,7 @@ msgstr ""
"Imate pristup varijablama 'env' i 'docs'"
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr "Demo izvještaj"
@ -50,6 +48,6 @@ msgid "Watermark expression"
msgstr "Izraz vodenog žiga"
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
msgstr "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr "ir.actions.report"

10
report_qweb_pdf_watermark/i18n/it.po

@ -13,10 +13,10 @@ msgstr ""
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: report_qweb_pdf_watermark
@ -27,7 +27,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -47,6 +47,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
msgstr "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr "ir.actions.report"

11
report_qweb_pdf_watermark/i18n/nb_NO.po

@ -11,12 +11,11 @@ msgstr ""
"POT-Creation-Date: 2017-01-10 03:40+0000\n"
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: Imre Kristoffer Eilertsen <imreeil42@gmail.com>, 2017\n"
"Language-Team: Norwegian Bokmål (Norway) (https://www.transifex.com/oca/"
"teams/23907/nb_NO/)\n"
"Language: nb_NO\n"
"Language-Team: Norwegian Bokmål (Norway) (https://www.transifex.com/oca/teams/23907/nb_NO/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: nb_NO\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: report_qweb_pdf_watermark
@ -27,7 +26,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -47,6 +46,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr ""

13
report_qweb_pdf_watermark/i18n/nl_NL.po

@ -11,12 +11,11 @@ msgstr ""
"POT-Creation-Date: 2017-06-23 00:28+0000\n"
"PO-Revision-Date: 2017-06-23 00:28+0000\n"
"Last-Translator: Peter Hageman <hageman.p@gmail.com>, 2017\n"
"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/"
"teams/23907/nl_NL/)\n"
"Language: nl_NL\n"
"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/teams/23907/nl_NL/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: nl_NL\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: report_qweb_pdf_watermark
@ -27,7 +26,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -47,6 +46,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
msgstr "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr "ir.actions.report"

11
report_qweb_pdf_watermark/i18n/pl.po

@ -12,12 +12,11 @@ msgstr ""
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Polish (https://www.transifex.com/oca/teams/23907/pl/)\n"
"Language: pl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
"|| n%100>=20) ? 1 : 2);\n"
"Language: pl\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#. module: report_qweb_pdf_watermark
#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression
@ -27,7 +26,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -47,6 +46,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr ""

8
report_qweb_pdf_watermark/i18n/pt.po

@ -12,10 +12,10 @@ msgstr ""
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Portuguese (https://www.transifex.com/oca/teams/23907/pt/)\n"
"Language: pt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: report_qweb_pdf_watermark
@ -26,7 +26,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -46,6 +46,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr ""

11
report_qweb_pdf_watermark/i18n/pt_BR.po

@ -11,12 +11,11 @@ msgstr ""
"POT-Creation-Date: 2017-01-10 03:40+0000\n"
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: Armando Vulcano Junior <vulcano@uol.com.br>, 2017\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/"
"teams/23907/pt_BR/)\n"
"Language: pt_BR\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: report_qweb_pdf_watermark
@ -27,7 +26,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -47,6 +46,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr ""

13
report_qweb_pdf_watermark/i18n/pt_PT.po

@ -12,12 +12,11 @@ msgstr ""
"POT-Creation-Date: 2017-01-14 06:07+0000\n"
"PO-Revision-Date: 2017-01-14 06:07+0000\n"
"Last-Translator: Carla Berjano <berjano.carla@gmail.com>, 2017\n"
"Language-Team: Portuguese (Portugal) (https://www.transifex.com/oca/"
"teams/23907/pt_PT/)\n"
"Language: pt_PT\n"
"Language-Team: Portuguese (Portugal) (https://www.transifex.com/oca/teams/23907/pt_PT/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_PT\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: report_qweb_pdf_watermark
@ -28,7 +27,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -48,6 +47,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
msgstr "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr "ir.actions.report"

11
report_qweb_pdf_watermark/i18n/sl.po

@ -12,12 +12,11 @@ msgstr ""
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>, 2017\n"
"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n"
"Language: sl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
"%100==4 ? 2 : 3);\n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: report_qweb_pdf_watermark
#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression
@ -27,7 +26,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -47,6 +46,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr ""

10
report_qweb_pdf_watermark/i18n/tr.po

@ -12,10 +12,10 @@ msgstr ""
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: Ahmet Altinisik <aaltinisik@altinkaya.com.tr>, 2017\n"
"Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/tr/)\n"
"Language: tr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: tr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: report_qweb_pdf_watermark
@ -26,7 +26,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -46,6 +46,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
msgstr "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr "ir.actions.report"

11
report_qweb_pdf_watermark/i18n/tr_TR.po

@ -11,12 +11,11 @@ msgstr ""
"POT-Creation-Date: 2017-01-10 03:40+0000\n"
"PO-Revision-Date: 2017-01-10 03:40+0000\n"
"Last-Translator: Ozge Altinisik <ozge@altinkaya.com.tr>, 2017\n"
"Language-Team: Turkish (Turkey) (https://www.transifex.com/oca/teams/23907/"
"tr_TR/)\n"
"Language: tr_TR\n"
"Language-Team: Turkish (Turkey) (https://www.transifex.com/oca/teams/23907/tr_TR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: tr_TR\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#. module: report_qweb_pdf_watermark
@ -27,7 +26,7 @@ msgid ""
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report
#: model:ir.actions.report,name:report_qweb_pdf_watermark.demo_report
msgid "Demo report"
msgstr ""
@ -47,6 +46,6 @@ msgid "Watermark expression"
msgstr ""
#. module: report_qweb_pdf_watermark
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
#: model:ir.model,name:report_qweb_pdf_watermark.model_ir.actions.report
msgid "ir.actions.report"
msgstr ""

2
report_qweb_pdf_watermark/models/__init__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import ir_actions_report_xml
from . import report

14
report_qweb_pdf_watermark/models/ir_actions_report_xml.py

@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class IrActionsReportXml(models.Model):
_inherit = 'ir.actions.report.xml'
pdf_watermark = fields.Binary('Watermark')
pdf_watermark_expression = fields.Char(
'Watermark expression', help='An expression yielding the base64 '
'encoded data to be used as watermark. \n'
'You have access to variables `env` and `docs`')

69
report_qweb_pdf_watermark/models/report.py

@ -1,43 +1,60 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from base64 import b64decode
from logging import getLogger
from PIL import Image
from StringIO import StringIO
from io import BytesIO
from pyPdf import PdfFileWriter, PdfFileReader
from pyPdf.utils import PdfReadError
try:
from PyPDF2 import PdfFileWriter, PdfFileReader # pylint: disable=W0404
from PyPDF2.utils import PdfReadError # pylint: disable=W0404
except ImportError:
pass
try:
# we need this to be sure PIL has loaded PDF support
from PIL import PdfImagePlugin # noqa: F401
except ImportError:
pass
from odoo import api, models, tools
from odoo import api, models, fields, tools
logger = getLogger(__name__)
try:
from PyPDF2 import PdfFileWriter, PdfFileReader # pylint: disable=W0404
from PyPDF2.utils import PdfReadError # pylint: disable=W0404
except ImportError:
logger.debug('Can not import PyPDF2')
class Report(models.Model):
_inherit = 'report'
_inherit = 'ir.actions.report'
pdf_watermark = fields.Binary('Watermark')
pdf_watermark_expression = fields.Char(
'Watermark expression', help='An expression yielding the base64 '
'encoded data to be used as watermark. \n'
'You have access to variables `env` and `docs`')
@api.multi
def render_qweb_pdf(self, res_ids=None, data=None):
if not self.env.context.get('res_ids'):
return super(
Report, self.with_context(res_ids=res_ids)
).render_qweb_pdf(res_ids=res_ids, data=data)
return super(Report, self).render_qweb_pdf(res_ids=res_ids, data=data)
@api.model
def get_pdf(self, docids, report_name, html=None, data=None):
result = super(Report, self).get_pdf(
docids, report_name, html=html, data=data)
report = self._get_report_from_name(report_name)
def _run_wkhtmltopdf(self, bodies, header=None, footer=None,
landscape=False, specific_paperformat_args=None,
set_viewport_size=False):
result = super(Report, self)._run_wkhtmltopdf(
bodies, header=header, footer=footer, landscape=landscape,
specific_paperformat_args=specific_paperformat_args,
set_viewport_size=set_viewport_size)
docids = self.env.context.get('res_ids', False)
watermark = None
if report.pdf_watermark:
watermark = b64decode(report.pdf_watermark)
elif report.pdf_watermark_expression:
if self.pdf_watermark:
watermark = b64decode(self.pdf_watermark)
elif docids:
watermark = tools.safe_eval(
report.pdf_watermark_expression,
dict(env=self.env, docs=self.env[report.model].browse(docids)),
self.pdf_watermark_expression or 'None',
dict(env=self.env, docs=self.env[self.model].browse(docids)),
)
if watermark:
watermark = b64decode(watermark)
@ -48,17 +65,17 @@ class Report(models.Model):
pdf = PdfFileWriter()
pdf_watermark = None
try:
pdf_watermark = PdfFileReader(StringIO(watermark))
pdf_watermark = PdfFileReader(BytesIO(watermark))
except PdfReadError:
# let's see if we can convert this with pillow
try:
Image.init()
image = Image.open(StringIO(watermark))
pdf_buffer = StringIO()
image = Image.open(BytesIO(watermark))
pdf_buffer = BytesIO()
if image.mode != 'RGB':
image = image.convert('RGB')
resolution = image.info.get(
'dpi', report.paperformat_id.dpi or 90
'dpi', self.paperformat_id.dpi or 90
)
if isinstance(resolution, tuple):
resolution = resolution[0]
@ -80,14 +97,14 @@ class Report(models.Model):
logger.debug('Your watermark pdf contains more than one page, '
'all but the first one will be ignored')
for page in PdfFileReader(StringIO(result)).pages:
for page in PdfFileReader(BytesIO(result)).pages:
watermark_page = pdf.addBlankPage(
page.mediaBox.getWidth(), page.mediaBox.getHeight()
)
watermark_page.mergePage(pdf_watermark.getPage(0))
watermark_page.mergePage(page)
pdf_content = StringIO()
pdf_content = BytesIO()
pdf.write(pdf_content)
return pdf_content.getvalue()

1
report_qweb_pdf_watermark/tests/__init__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_report_qweb_pdf_watermark

11
report_qweb_pdf_watermark/tests/test_report_qweb_pdf_watermark.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from PIL import Image
@ -6,6 +5,7 @@ from odoo.tests.common import HttpCase
class TestReportQwebPdfWatermark(HttpCase):
def test_report_qweb_pdf_watermark(self):
Image.init()
# with our image, we have three
@ -24,8 +24,7 @@ class TestReportQwebPdfWatermark(HttpCase):
self._test_report_images(3)
def _test_report_images(self, number):
pdf = self.env['report'].get_pdf(
self.env['res.users'].search([]).ids,
'report_qweb_pdf_watermark.demo_report_view',
)
self.assertEqual(pdf.count('/Subtype /Image'), number)
report = self.env['ir.model.data'].xmlid_to_object(
'report_qweb_pdf_watermark.demo_report')
pdf, _ = report.render_qweb_pdf(self.env['res.users'].search([]).ids)
self.assertEqual(pdf.count(b'/Subtype /Image'), number)

2
report_qweb_pdf_watermark/views/ir_actions_report_xml.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="act_report_xml_view" model="ir.ui.view">
<field name="model">ir.actions.report.xml</field>
<field name="model">ir.actions.report</field>
<field name="inherit_id" ref="base.act_report_xml_view" />
<field name="arch" type="xml">
<field name="attachment" position="after">

2
report_qweb_pdf_watermark/views/layout_templates.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- Include fix for https://github.com/odoo/odoo/issues/16610 -->
<template id="assets_pdf" inherit_id="report.assets_pdf">
<template id="assets_pdf" inherit_id="web.report_assets_pdf">
<link position="after">
<link href="/report_qweb_pdf_watermark/static/src/css/report_qweb_pdf_watermark.css"
rel="stylesheet"/>

Loading…
Cancel
Save