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.

32 lines
1.1 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 openerp.tests.common import TransactionCase
  5. class TestReportQwebPdfWatermark(TransactionCase):
  6. def test_report_qweb_pdf_watermark(self):
  7. # with our image, we have three
  8. self._test_report_images(3)
  9. self.env.ref('report_qweb_pdf_watermark.demo_report').write({
  10. 'pdf_watermark_expression': False,
  11. })
  12. # without, we have two
  13. self._test_report_images(2)
  14. self.env.ref('report_qweb_pdf_watermark.demo_report').write({
  15. 'pdf_watermark': self.env.user.company_id.logo,
  16. })
  17. # and now we should have three again
  18. self._test_report_images(3)
  19. def _test_report_images(self, number):
  20. pdf = self.registry['report'].get_pdf(
  21. self.cr,
  22. self.uid,
  23. self.env['res.users'].search([]).ids,
  24. 'report_qweb_pdf_watermark.demo_report_view',
  25. context={}
  26. )
  27. self.assertEqual(pdf.count('/Subtype /Image'), number)