OCA reporting engine fork for dev and update.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.0 KiB

  1. # -*- coding: utf-8 -*-
  2. # © 2016 Therp BV <http://therp.nl>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from PIL import Image
  5. from odoo.tests.common import HttpCase
  6. class TestReportQwebPdfWatermark(HttpCase):
  7. def test_report_qweb_pdf_watermark(self):
  8. Image.init()
  9. # with our image, we have three
  10. self._test_report_images(3)
  11. self.env.ref('report_qweb_pdf_watermark.demo_report').write({
  12. 'pdf_watermark_expression': False,
  13. })
  14. # without, we have two
  15. self._test_report_images(2)
  16. self.env.ref('report_qweb_pdf_watermark.demo_report').write({
  17. 'pdf_watermark': self.env.user.company_id.logo,
  18. })
  19. # and now we should have three again
  20. self._test_report_images(3)
  21. def _test_report_images(self, number):
  22. pdf = self.env['report'].get_pdf(
  23. self.env['res.users'].search([]).ids,
  24. 'report_qweb_pdf_watermark.demo_report_view',
  25. )
  26. self.assertEqual(pdf.count('/Subtype /Image'), number)