report_qweb_pdf_watermark (#86)

This commit is contained in:
Holger Brunn
2017-01-09 21:48:17 +01:00
committed by fshah
parent aa04a45159
commit e20055c740
11 changed files with 271 additions and 0 deletions

View 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

View File

@@ -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)