Skip to content

Conversation

@etobella
Copy link
Member

When we are trying to create a Watermark from a PNG, we need to import PdfImagePlugin.

"name": "Pdf watermark",
"version": "10.0.1.0.0",
"author": "Therp BV,Odoo Community Association (OCA)",
"version": "10.0.2.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fix, not a new refactoring, so please change only last number. Check https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md#version-numbers

except PdfReadError:
# let's see if we can convert this with pillow
try:
from PIL import PdfImagePlugin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this import used?

@etobella etobella force-pushed the 10.0-fix_watermark_png branch 3 times, most recently from 75b8e2a to ec30d60 Compare June 20, 2017 09:50
@etobella
Copy link
Member Author

If PdfImagePlugin is not initialized, we cannot transform a PNG image to PDF. The problem is related to Pillow creation: https://github.com/python-pillow/Pillow/blob/master/PIL/PdfImagePlugin.py

@pedrobaeza
Copy link
Member

Please add this explanation as comment before the import line so that others that see the code don't wonder the same.

@JordiBForgeFlow
Copy link
Member

@alexis-via We need your help to test the generation of reports in PDF. Currently we are getting stuck when the wkhtmltopdf process is run, and a subprocess is open:
https://github.com/odoo/odoo/blob/10.0/addons/report/models/report.py#L445

However it seems that you managed to get past this issue here!:
https://github.com/akretion/edi/blob/10-migrate/account_invoice_factur-x/tests/test_facturx_invoice.py#L16

@etobella etobella force-pushed the 10.0-fix_watermark_png branch 2 times, most recently from 0c22939 to 6daceca Compare June 21, 2017 08:24
install:
- git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- export WKHTMLTOPDF_VERSION=0.12.4
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is currently working on travis. The problem was related to wkhtmltopdf version. It must be 0.12.4, so I download it using travis_install_nightly.
Default Wkhtmltopdf version is not working because it does not add headers on the exported reports.

from StringIO import StringIO
from odoo import api, models, tools
from PIL import PdfImagePlugin # flake8: noqa

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment added on the code.
Codecov will fail because previous commits were failing.

Copy link
Member

@JordiBForgeFlow JordiBForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on runbot. Allows to print from a watermark using a PNG image

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will mean a problem with my other PR (https://github.com/OCA/reporting-engine/pull/145/files#diff-354f30a63fb0907d4ad57269548329e3R9), but when the first will be merged, then we solve the conflicts

@pedrobaeza
Copy link
Member

Fast-tracking this for leading with the other PR

@pedrobaeza pedrobaeza merged commit 074f3a2 into OCA:10.0 Jun 23, 2017
@etobella etobella deleted the 10.0-fix_watermark_png branch June 23, 2017 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants