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.

24 lines
844 B

  1. # Copyright 2017 Creu Blanca
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
  3. from odoo.tests import common
  4. import logging
  5. _logger = logging.getLogger(__name__)
  6. try:
  7. from xlrd import open_workbook
  8. except ImportError:
  9. _logger.debug('Can not import xlsxwriter`.')
  10. class TestReport(common.TransactionCase):
  11. def test_report(self):
  12. report_object = self.env['ir.actions.report']
  13. report_name = 'report_xlsx.partner_xlsx'
  14. report = report_object._get_report_from_name(report_name)
  15. docs = self.env['res.company'].search([], limit=1).partner_id
  16. self.assertEqual(report.report_type, 'xlsx')
  17. rep = report.render(docs.ids, {})
  18. wb = open_workbook(file_contents=rep[0])
  19. sheet = wb.sheet_by_index(0)
  20. self.assertEqual(sheet.cell(0, 0).value, docs.name)