mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
report_qweb_pdf_watermark (#86)
This commit is contained in:
4
report_qweb_pdf_watermark/tests/__init__.py
Normal file
4
report_qweb_pdf_watermark/tests/__init__.py
Normal file
@@ -0,0 +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 test_report_qweb_pdf_watermark
|
||||
@@ -0,0 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2016 Therp BV <http://therp.nl>
|
||||
# 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.registry['report'].get_pdf(
|
||||
self.cr,
|
||||
self.uid,
|
||||
self.env['res.users'].search([]).ids,
|
||||
'report_qweb_pdf_watermark.demo_report_view',
|
||||
context={}
|
||||
)
|
||||
self.assertEqual(pdf.count('/Subtype /Image'), number)
|
||||
Reference in New Issue
Block a user