diff --git a/report_qweb_pdf_watermark/README.rst b/report_qweb_pdf_watermark/README.rst new file mode 100644 index 00000000..cac6f764 --- /dev/null +++ b/report_qweb_pdf_watermark/README.rst @@ -0,0 +1,65 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +============= +Pdf watermark +============= + +This module was written to add watermarks (backgrounds) to PDF reports. Because of the way wkhtmltopdf handles headers and footers in the current versions, it is quite impossible to have a background for the complete page using HTML and CSS. That is why this module inserts the image at the PDF level. + +Usage +===== + +To use this module, you need to: + +#. go to your report +#. select a PDF or image to use as watermark. Note that resolutions and size must match, otherwise you'll have funny results +#. You can also fill in an expression that returns the data (base64 encoded) to be used as watermark + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/143/8.0 + +Known Issues +============ +This module depends on support for transparent backgrounds in Wkhtmltopdf, which has been flaky in the past. This module has been reported to work with Wkhtmltopdf 0.12.4. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Holger Brunn +* Stefan Rijnhart + +Do not contact contributors directly about help with questions or problems concerning this addon, but use the `community mailing list `_ or the `appropriate specialized mailinglist `_ for help, and the bug tracker linked in `Bug Tracker`_ above for technical issues. + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/report_qweb_pdf_watermark/__init__.py b/report_qweb_pdf_watermark/__init__.py new file mode 100644 index 00000000..7eda98a2 --- /dev/null +++ b/report_qweb_pdf_watermark/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# © 2016 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from . import models diff --git a/report_qweb_pdf_watermark/__manifest__.py b/report_qweb_pdf_watermark/__manifest__.py new file mode 100644 index 00000000..e6e779d4 --- /dev/null +++ b/report_qweb_pdf_watermark/__manifest__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# © 2016 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Pdf watermark", + "version": "10.0.1.0.0", + "author": "Therp BV,Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "Reporting", + "summary": "Add watermarks to your QWEB PDF reports", + "depends": [ + 'report', + ], + "data": [ + "demo/report.xml", + "views/ir_actions_report_xml.xml", + "views/layout_templates.xml", + ], +} diff --git a/report_qweb_pdf_watermark/demo/report.xml b/report_qweb_pdf_watermark/demo/report.xml new file mode 100644 index 00000000..7528dbf9 --- /dev/null +++ b/report_qweb_pdf_watermark/demo/report.xml @@ -0,0 +1,28 @@ + + + + + docs[:1].company_id.logo + + + diff --git a/report_qweb_pdf_watermark/i18n/ca.po b/report_qweb_pdf_watermark/i18n/ca.po new file mode 100644 index 00000000..922605a1 --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/ca.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# Carles Antoli , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-10 03:40+0000\n" +"PO-Revision-Date: 2017-01-10 03:40+0000\n" +"Last-Translator: Carles Antoli , 2017\n" +"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/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 +#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +msgstr "Informe" + +#. 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 "" + +#. 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 "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml +msgid "ir.actions.report.xml" +msgstr "" diff --git a/report_qweb_pdf_watermark/i18n/da.po b/report_qweb_pdf_watermark/i18n/da.po new file mode 100644 index 00000000..d4abe9a7 --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/da.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# Hans Henrik Gabelgaard , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-10 03:40+0000\n" +"PO-Revision-Date: 2017-01-10 03:40+0000\n" +"Last-Translator: Hans Henrik Gabelgaard , 2017\n" +"Language-Team: Danish (https://www.transifex.com/oca/teams/23907/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 +#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +msgstr "Rapport" + +#. 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 "" + +#. 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 "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml +msgid "ir.actions.report.xml" +msgstr "" diff --git a/report_qweb_pdf_watermark/i18n/de.po b/report_qweb_pdf_watermark/i18n/de.po new file mode 100644 index 00000000..07eaf28f --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/de.po @@ -0,0 +1,54 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# OCA Transbot , 2017 +# Rudolf Schnapka , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-03-04 05:58+0000\n" +"PO-Revision-Date: 2017-03-04 05:58+0000\n" +"Last-Translator: Rudolf Schnapka , 2017\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/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 +#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression +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" +"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 +msgid "Demo report" +msgstr "Beispielbericht" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +msgstr "Bericht" + +#. 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 "Wasserzeichen" + +#. 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 "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" diff --git a/report_qweb_pdf_watermark/i18n/el_GR.po b/report_qweb_pdf_watermark/i18n/el_GR.po new file mode 100644 index 00000000..5e375d30 --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/el_GR.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# Kostas Goutoudis , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-10 03:40+0000\n" +"PO-Revision-Date: 2017-01-10 03:40+0000\n" +"Last-Translator: Kostas Goutoudis , 2017\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 +#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +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 "" + +#. 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 "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml +msgid "ir.actions.report.xml" +msgstr "" diff --git a/report_qweb_pdf_watermark/i18n/es.po b/report_qweb_pdf_watermark/i18n/es.po new file mode 100644 index 00000000..8e2d25cf --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/es.po @@ -0,0 +1,54 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# Pedro M. Baeza , 2017 +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-10 03:40+0000\n" +"PO-Revision-Date: 2017-01-10 03:40+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/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 +#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression +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" +"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 +msgid "Demo report" +msgstr "Informe demo" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +msgstr "Informe" + +#. 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 "Marca de agua" + +#. 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 "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" diff --git a/report_qweb_pdf_watermark/i18n/es_CO.po b/report_qweb_pdf_watermark/i18n/es_CO.po new file mode 100644 index 00000000..02428bcf --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/es_CO.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# John Toro , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-10 03:40+0000\n" +"PO-Revision-Date: 2017-01-10 03:40+0000\n" +"Last-Translator: John Toro , 2017\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 +#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +msgstr "Iforme" + +#. 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 "" + +#. 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 "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml +msgid "ir.actions.report.xml" +msgstr "" diff --git a/report_qweb_pdf_watermark/i18n/fr.po b/report_qweb_pdf_watermark/i18n/fr.po new file mode 100644 index 00000000..7119bbd0 --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/fr.po @@ -0,0 +1,52 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# Yannick Vaucher , 2017 +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-10 03:40+0000\n" +"PO-Revision-Date: 2017-01-10 03:40+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/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 +#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +msgstr "Rapport" + +#. 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 "" + +#. 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 "" + +#. 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" diff --git a/report_qweb_pdf_watermark/i18n/gl.po b/report_qweb_pdf_watermark/i18n/gl.po new file mode 100644 index 00000000..a1a41315 --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/gl.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# Alejandro Santana , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-10 03:40+0000\n" +"PO-Revision-Date: 2017-01-10 03:40+0000\n" +"Last-Translator: Alejandro Santana , 2017\n" +"Language-Team: Galician (https://www.transifex.com/oca/teams/23907/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 +#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +msgstr "Informe" + +#. 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 "" + +#. 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 "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml +msgid "ir.actions.report.xml" +msgstr "" diff --git a/report_qweb_pdf_watermark/i18n/hr.po b/report_qweb_pdf_watermark/i18n/hr.po new file mode 100644 index 00000000..1fba7351 --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/hr.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# Bole , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-10 03:40+0000\n" +"PO-Revision-Date: 2017-01-10 03:40+0000\n" +"Last-Translator: Bole , 2017\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \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 +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +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 "" + +#. 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 "" + +#. 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" diff --git a/report_qweb_pdf_watermark/i18n/it.po b/report_qweb_pdf_watermark/i18n/it.po new file mode 100644 index 00000000..76fe5970 --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/it.po @@ -0,0 +1,52 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# Paolo Valier , 2017 +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-10 03:40+0000\n" +"PO-Revision-Date: 2017-01-10 03:40+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/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 +#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +msgstr "Report" + +#. 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 "" + +#. 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 "" + +#. 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" diff --git a/report_qweb_pdf_watermark/i18n/nb_NO.po b/report_qweb_pdf_watermark/i18n/nb_NO.po new file mode 100644 index 00000000..9ef3189b --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/nb_NO.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# Imre Kristoffer Eilertsen , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"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 , 2017\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 +#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +msgstr "Rapport" + +#. 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 "" + +#. 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 "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml +msgid "ir.actions.report.xml" +msgstr "" diff --git a/report_qweb_pdf_watermark/i18n/pl.po b/report_qweb_pdf_watermark/i18n/pl.po new file mode 100644 index 00000000..57f39208 --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/pl.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-10 03:40+0000\n" +"PO-Revision-Date: 2017-01-10 03:40+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Polish (https://www.transifex.com/oca/teams/23907/pl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \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 +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +msgstr "Raport" + +#. 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 "" + +#. 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 "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml +msgid "ir.actions.report.xml" +msgstr "" diff --git a/report_qweb_pdf_watermark/i18n/pt.po b/report_qweb_pdf_watermark/i18n/pt.po new file mode 100644 index 00000000..b4eee93e --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/pt.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-10 03:40+0000\n" +"PO-Revision-Date: 2017-01-10 03:40+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Portuguese (https://www.transifex.com/oca/teams/23907/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 +#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +msgstr "Relatório" + +#. 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 "" + +#. 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 "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml +msgid "ir.actions.report.xml" +msgstr "" diff --git a/report_qweb_pdf_watermark/i18n/pt_BR.po b/report_qweb_pdf_watermark/i18n/pt_BR.po new file mode 100644 index 00000000..6002005f --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/pt_BR.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# Armando Vulcano Junior , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"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 , 2017\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 +#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +msgstr "Relatório" + +#. 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 "" + +#. 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 "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml +msgid "ir.actions.report.xml" +msgstr "" diff --git a/report_qweb_pdf_watermark/i18n/pt_PT.po b/report_qweb_pdf_watermark/i18n/pt_PT.po new file mode 100644 index 00000000..9be87c18 --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/pt_PT.po @@ -0,0 +1,52 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# OCA Transbot , 2017 +# Carla Berjano , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-14 06:07+0000\n" +"PO-Revision-Date: 2017-01-14 06:07+0000\n" +"Last-Translator: Carla Berjano , 2017\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 +#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +msgstr "Relatório" + +#. 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 "" + +#. 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 "" + +#. 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" diff --git a/report_qweb_pdf_watermark/i18n/sl.po b/report_qweb_pdf_watermark/i18n/sl.po new file mode 100644 index 00000000..b75fa349 --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/sl.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# Matjaž Mozetič , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-10 03:40+0000\n" +"PO-Revision-Date: 2017-01-10 03:40+0000\n" +"Last-Translator: Matjaž Mozetič , 2017\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \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 +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +msgstr "Poročilo" + +#. 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 "" + +#. 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 "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml +msgid "ir.actions.report.xml" +msgstr "" diff --git a/report_qweb_pdf_watermark/i18n/tr.po b/report_qweb_pdf_watermark/i18n/tr.po new file mode 100644 index 00000000..d721393f --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/tr.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# Ahmet Altinisik , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-10 03:40+0000\n" +"PO-Revision-Date: 2017-01-10 03:40+0000\n" +"Last-Translator: Ahmet Altinisik , 2017\n" +"Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/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 +#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +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 "" + +#. 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 "" + +#. 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" diff --git a/report_qweb_pdf_watermark/i18n/tr_TR.po b/report_qweb_pdf_watermark/i18n/tr_TR.po new file mode 100644 index 00000000..3ed8bbdb --- /dev/null +++ b/report_qweb_pdf_watermark/i18n/tr_TR.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_qweb_pdf_watermark +# +# Translators: +# Ozge Altinisik , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-01-10 03:40+0000\n" +"PO-Revision-Date: 2017-01-10 03:40+0000\n" +"Last-Translator: Ozge Altinisik , 2017\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 +#: model:ir.model.fields,help:report_qweb_pdf_watermark.field_ir_act_report_xml_pdf_watermark_expression +msgid "" +"An expression yielding the base64 encoded data to be used as watermark. \n" +"You have access to variables `env` and `docs`" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.actions.report.xml,name:report_qweb_pdf_watermark.demo_report +msgid "Demo report" +msgstr "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_report +msgid "Report" +msgstr "Rapor" + +#. 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 "" + +#. 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 "" + +#. module: report_qweb_pdf_watermark +#: model:ir.model,name:report_qweb_pdf_watermark.model_ir_actions_report_xml +msgid "ir.actions.report.xml" +msgstr "" diff --git a/report_qweb_pdf_watermark/models/__init__.py b/report_qweb_pdf_watermark/models/__init__.py new file mode 100644 index 00000000..e9e37ae5 --- /dev/null +++ b/report_qweb_pdf_watermark/models/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from . import ir_actions_report_xml +from . import report diff --git a/report_qweb_pdf_watermark/models/ir_actions_report_xml.py b/report_qweb_pdf_watermark/models/ir_actions_report_xml.py new file mode 100644 index 00000000..ff211619 --- /dev/null +++ b/report_qweb_pdf_watermark/models/ir_actions_report_xml.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# © 2016 Therp BV +# 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`') diff --git a/report_qweb_pdf_watermark/models/report.py b/report_qweb_pdf_watermark/models/report.py new file mode 100644 index 00000000..5125cd3c --- /dev/null +++ b/report_qweb_pdf_watermark/models/report.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +# © 2016 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from base64 import b64decode +from logging import getLogger +from pyPdf import PdfFileWriter, PdfFileReader +from pyPdf.utils import PdfReadError +from PIL import Image +from StringIO import StringIO +from odoo import api, models, tools +logger = getLogger(__name__) + + +class Report(models.Model): + _inherit = 'report' + + @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) + watermark = None + if report.pdf_watermark: + watermark = b64decode(report.pdf_watermark) + else: + watermark = tools.safe_eval( + report.pdf_watermark_expression or 'None', + dict(env=self.env, docs=self.env[report.model].browse(docids)), + ) + if watermark: + watermark = b64decode(watermark) + + if not watermark: + return result + + pdf = PdfFileWriter() + pdf_watermark = None + try: + pdf_watermark = PdfFileReader(StringIO(watermark)) + except PdfReadError: + # let's see if we can convert this with pillow + try: + image = Image.open(StringIO(watermark)) + pdf_buffer = StringIO() + if image.mode != 'RGB': + image = image.convert('RGB') + resolution = image.info.get( + 'dpi', report.paperformat_id.dpi or 90 + ) + if isinstance(resolution, tuple): + resolution = resolution[0] + image.save(pdf_buffer, 'pdf', resolution=resolution) + pdf_watermark = PdfFileReader(pdf_buffer) + except: + logger.exception('Failed to load watermark') + + if not pdf_watermark: + logger.error( + 'No usable watermark found, got %s...', watermark[:100] + ) + return result + + if pdf_watermark.numPages < 1: + logger.error('Your watermark pdf does not contain any pages') + return result + if pdf_watermark.numPages > 1: + 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: + 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.write(pdf_content) + + return pdf_content.getvalue() diff --git a/report_qweb_pdf_watermark/static/description/icon.png b/report_qweb_pdf_watermark/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/report_qweb_pdf_watermark/static/description/icon.png differ diff --git a/report_qweb_pdf_watermark/static/src/css/report_qweb_pdf_watermark.css b/report_qweb_pdf_watermark/static/src/css/report_qweb_pdf_watermark.css new file mode 100644 index 00000000..83cc2eb0 --- /dev/null +++ b/report_qweb_pdf_watermark/static/src/css/report_qweb_pdf_watermark.css @@ -0,0 +1,3 @@ +body { + background: transparent !important; +} diff --git a/report_qweb_pdf_watermark/tests/__init__.py b/report_qweb_pdf_watermark/tests/__init__.py new file mode 100644 index 00000000..e4637a64 --- /dev/null +++ b/report_qweb_pdf_watermark/tests/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# © 2016 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from . import test_report_qweb_pdf_watermark diff --git a/report_qweb_pdf_watermark/tests/test_report_qweb_pdf_watermark.py b/report_qweb_pdf_watermark/tests/test_report_qweb_pdf_watermark.py new file mode 100644 index 00000000..c39e8cdd --- /dev/null +++ b/report_qweb_pdf_watermark/tests/test_report_qweb_pdf_watermark.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# © 2016 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openerp.tests.common import TransactionCase + + +class TestReportQwebPdfWatermark(TransactionCase): + def test_report_qweb_pdf_watermark(self): + # with our image, we have three + self._test_report_images(3) + + self.env.ref('report_qweb_pdf_watermark.demo_report').write({ + 'pdf_watermark_expression': False, + }) + # without, we have two + self._test_report_images(2) + + self.env.ref('report_qweb_pdf_watermark.demo_report').write({ + 'pdf_watermark': self.env.user.company_id.logo, + }) + # and now we should have three again + 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) diff --git a/report_qweb_pdf_watermark/views/ir_actions_report_xml.xml b/report_qweb_pdf_watermark/views/ir_actions_report_xml.xml new file mode 100644 index 00000000..3668c4fc --- /dev/null +++ b/report_qweb_pdf_watermark/views/ir_actions_report_xml.xml @@ -0,0 +1,13 @@ + + + + ir.actions.report.xml + + + + + + + + + diff --git a/report_qweb_pdf_watermark/views/layout_templates.xml b/report_qweb_pdf_watermark/views/layout_templates.xml new file mode 100644 index 00000000..fee74c75 --- /dev/null +++ b/report_qweb_pdf_watermark/views/layout_templates.xml @@ -0,0 +1,10 @@ + + + + +